alias Tablo::DataCellStyler

Overview

1st form : Proc(CellType, String, CellData, Int32, String)

styler: ->(_c : Tablo::CellType, s : String, r : Tablo::CellData, line : Int32) {
  if line == 1
    s.colorize(:magenta).mode(:bold).to_s
  else
    if r.row_index % 2 == 0
      if r.column_index % 2 == 0
        s.colorize(:red).to_s
      else
        s.colorize(:yellow).to_s
      end
    else
      s.colorize(:blue).to_s
    end
  end
}

2nd form : Proc(CellType, String, CellData, String)

styler: ->(_c : Tablo::CellType, s : String, r : Tablo::CellData) {
  if r.row_index % 2 == 0
    if r.column_index % 2 == 0
      s.colorize(:red).to_s
    else
      s.colorize(:yellow).to_s
    end
  else
    s.colorize(:blue).to_s
  end
   }

3rd form : Proc(CellType, String, String)

styler: ->(c : Tablo::CellType, s : String) {
  if c.as(Float64) < 0.0
    s.colorize(:red).to_s
  else
    s.colorize(:green).to_s
  end
}

Alias Definition

String -> String | Tablo::CellType, String -> String | Tablo::CellType, Tablo::CellData, String, Int32 -> String | Tablo::CellType, Tablo::CellData, String -> String

Defined in:

types.cr