alias Tablo::TextCellStyler

Overview

Styler procs for text cell types.

Using the first form (Proc(String, String)), the whole content of the cell may be styled.

Example :

styler: ->(content : String) { content.colorize(:blue).to_s }

If (Proc(String, Int32, String)) is used, the Int32 is the line number (0..n) inside the (possibly multiline) cell, thus allowing to differently style each line.

Example:

styler: ->(content : String, line : Int32) {
  case line
  when 0
    content.colorize(:blue).to_s
  when 1
    content.colorize(:green).to_s
  else
    content.colorize(:red).to_s
  end
}

Alias Definition

String, Int32 -> String | String -> String

Defined in:

types.cr