Module: Skylab::Face::Colors
- Extended by:
- Colors
- Included in:
- Cli, Colors, Command, Skylab::Face::Command::Namespace, Skylab::Face::Command::Namespace
- Defined in:
- lib/myterm/vendor/skylab/face/cli.rb
Constant Summary collapse
- Styles =
{ :bright => 1, :red => 31, :yellow => 33, :green => 32, :cyan => 36 }
- Esc =
“u001b” ok in 1.9.2
"\e"
Instance Method Summary collapse
- #bold(str) ⇒ Object
- #hi(str) ⇒ Object
- #highlight_header(str) ⇒ Object
- #ohno(str) ⇒ Object
- #style(str, *styles) ⇒ Object
- #yelo(str) ⇒ Object
Instance Method Details
#bold(str) ⇒ Object
15 |
# File 'lib/myterm/vendor/skylab/face/cli.rb', line 15 def bold str ; style str, :bright, :green end |
#hi(str) ⇒ Object
16 |
# File 'lib/myterm/vendor/skylab/face/cli.rb', line 16 def hi str ; style str, :green end |
#highlight_header(str) ⇒ Object
25 26 27 |
# File 'lib/myterm/vendor/skylab/face/cli.rb', line 25 def highlight_header str str.sub(/\A([^:]+:)/) { "#{hi($1)}" } end |
#ohno(str) ⇒ Object
17 |
# File 'lib/myterm/vendor/skylab/face/cli.rb', line 17 def ohno str ; style str, :red end |
#style(str, *styles) ⇒ Object
21 22 23 24 |
# File 'lib/myterm/vendor/skylab/face/cli.rb', line 21 def style str, *styles nums = styles.map{ |o| o.kind_of?(Integer) ? o : Styles[o] }.compact "#{Esc}[#{nums.join(';')}m#{str}#{Esc}[0m" end |
#yelo(str) ⇒ Object
18 |
# File 'lib/myterm/vendor/skylab/face/cli.rb', line 18 def yelo str ; style str, :yellow end |