abstract class Novika::Capabilities::IInk
- Novika::Capabilities::IInk
- Reference
- Object
Overview
Enables colorful output using withColorAppendEcho
and friends.
Exposed vocabulary:
withEchoFg
, generic implementationwithEchoBg
, generic implementationdropEchoFg
, generic implementationdropEchoBg
, generic implementationwithColorAppendEcho
, implemented by#with_color_append_echo
withEmphasisAppendEcho
, implemented by#with_emphasis_append_echo
withReverseAppendEcho
, generic implementation; when no colors given by the use,#with_reverse_append_echo
is used.
Included Modules
Extended Modules
Direct Known Subclasses
Defined in:
novika/capabilities/ink.crConstant Summary
-
NO_SYSTEM_ECHO_ERROR =
"with...Echo words need 'echo' from capability 'system', but this capability is not available"
Class Method Summary
Instance Method Summary
-
#bg : Array(Novika::Color)
Echo background color stack.
-
#bg=(bg : Array(Novika::Color))
Echo background color stack.
-
#enabled=(enabled : Bool)
Holds whether printing with colors is enabled (and desired).
-
#enabled? : Bool
Holds whether printing with colors is enabled (and desired).
-
#fg : Array(Novika::Color)
Echo foreground color stack.
-
#fg=(fg : Array(Novika::Color))
Echo foreground color stack.
-
#inject(into target)
Injects the colors vocabulary into target.
-
#with_color_append_echo(engine, fg : Color | Nil, bg : Color | Nil, form : Form)
Appends form with fg foreground color (if any) and bg background color (if any) to the standard output stream.
-
#with_emphasis_append_echo(engine, fg : Color | Nil, bg : Color | Nil, form : Form)
Same as
#with_color_append_echo
, but also emphasizes echo of form. -
#with_reverse_append_echo(engine, form : Form)
Appends form with inverse style (background color is set to foreground color, and vice versa).
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
Class Method Detail
Instance Method Detail
Holds whether printing with colors is enabled (and desired).
Defaults to Novika.colorful?
.
Holds whether printing with colors is enabled (and desired).
Defaults to Novika.colorful?
.
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.
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.
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.