class Novika::Capabilities::Impl::Ink

Defined in:

novika/capabilities/impl/ink.cr

Constant Summary

COMPAT = {Color.rgb(0, 0, 0) => :black, Color.rgb(128, 0, 0) => :red, Color.rgb(0, 128, 0) => :green, Color.rgb(128, 128, 0) => :yellow, Color.rgb(0, 0, 128) => :blue, Color.rgb(128, 0, 128) => :magenta, Color.rgb(0, 128, 128) => :cyan, Color.rgb(192, 192, 192) => :light_gray, Color.rgb(128, 128, 128) => :dark_gray, Color.rgb(255, 0, 0) => :light_red, Color.rgb(0, 255, 0) => :light_green, Color.rgb(255, 255, 0) => :light_yellow, Color.rgb(0, 0, 255) => :light_blue, Color.rgb(255, 0, 255) => :light_magenta, Color.rgb(0, 255, 255) => :light_cyan, Color.rgb(255, 255, 255) => :white}

Instance Method Summary

Instance methods inherited from class Novika::Capabilities::IInk

bg : Array(Novika::Color) bg, bg=(bg : Array(Novika::Color)) bg=, enabled=(enabled : Bool) enabled=, enabled? : Bool enabled?, fg : Array(Novika::Color) fg, fg=(fg : Array(Novika::Color)) fg=, inject(into target) inject, with_color_append_echo(engine, fg : Color | Nil, bg : Color | Nil, form : Form) with_color_append_echo, with_emphasis_append_echo(engine, fg : Color | Nil, bg : Color | Nil, form : Form) with_emphasis_append_echo, with_reverse_append_echo(engine, form : Form) with_reverse_append_echo

Class methods inherited from class Novika::Capabilities::IInk

id : String id, on_by_default? : Bool on_by_default?, purpose : String purpose

Instance methods inherited from module Novika::ICapability

capabilities : CapabilityCollection capabilities, inject(into target : Block) inject

Constructor methods inherited from module Novika::ICapability

new(capabilities) new

Instance Method Detail

def with_color_append_echo(engine, fg : Color | Nil, bg : Color | Nil, form : Form) #
Description copied from class Novika::Capabilities::IInk

Appends form with fg foreground color (if any) and bg background color (if any) to the standard output stream. One of fg, bg is guaranteed to be non-nil.


[View source]
def with_emphasis_append_echo(engine, fg : Color | Nil, bg : Color | Nil, form : Form) #
Description copied from class Novika::Capabilities::IInk

Same as #with_color_append_echo, but also emphasizes echo of form. Bold style is used by default, but implementors may choose e.g. italic.


[View source]
def with_reverse_append_echo(engine, form : Form) #
Description copied from class Novika::Capabilities::IInk

Appends form with inverse style (background color is set to foreground color, and vice versa).

Note: if both foreground and background colors are set by the user, #with_color_append_echo is preferred over this method.


[View source]