class Oho::T416ColorEscapeCode

Defined in:

oho/t_416_color_escape_code.cr

Constant Summary

BASIC_FOREGROUND_COLOR_LOOKUP = {30 => "dimgray", 31 => "red", 32 => "lime", 33 => "yellow", 34 => "#3333FF", 35 => "fuchsia", 36 => "aqua", 37 => "white"}
CONTENT_COLOR_TABLE_LOOKUP = {1 => 30, 2 => 31, 3 => 32, 4 => 33, 5 => 34, 6 => 35, 7 => 36, 0 => 37}
FOREGROUND_COLOR_INTS = BASIC_FOREGROUND_COLOR_LOOKUP.keys

Constructors

Instance Method Summary

Instance methods inherited from class Oho::EscapeCode

affects_display? : Bool affects_display?, raw : String raw, styles : Array(Int32) styles, to_span(escape_code : EscapeCode | Nil) : String to_span

Constructor methods inherited from class Oho::EscapeCode

new(string : String, options : Hash(Symbol, String)) new

Constructor Detail

def self.new(string : String, options : Hash(Symbol, String)) #

[View source]

Instance Method Detail

def affects_display? : Bool #

[View source]
def background_color : String? #

[View source]
def convert_cmy_to_rgb(cyan : Int32, magenta : Int32, yellow : Int32) : Tuple(Int32, Int32, Int32) #

[View source]
def foreground_color : String? #

[View source]
def generate_background_string(escape_code : EscapeCode | Nil) : String #

TODO refactor this into EscapeCode


[View source]
def raw : String #

[View source]
def string : String #

[View source]
def styles : Array(Int32) #

[View source]
def to_span(escape_code : EscapeCode | Nil) : String #

we take in the last escap_code in part to know we have to end the prior code and in part to know what needs to be continued if it is ended. if we we to simply nest them and tack a pile of end spans at the end of the document we'd give the headaches to the browser and anyone reading the source. Headaches are bad.


[View source]