Class: Unmagic::Color::Console::Help
- Inherits:
-
Object
- Object
- Unmagic::Color::Console::Help
- Defined in:
- lib/unmagic/color/console/help.rb
Overview
Renders the help text for the console.
Instance Method Summary collapse
-
#render ⇒ String
Render the help text with syntax highlighting.
-
#to_s ⇒ String
The rendered help text.
Instance Method Details
#render ⇒ String
Render the help text with syntax highlighting.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/unmagic/color/console/help.rb', line 16 def render link = highlighter.link("https://github.com/unreasonable-magic/unmagic-color") code = highlighter.highlight(<<~RUBY) # Parse a color (hex, rgb, hsl, oklch, ansi, css named, x11) parse("#ff5733") parse("goldenrod") # Manually create colors rgb(255, 87, 51, alpha: percentage(50)) hsl(9, 100, 60) oklch(0.65, 0.22, 30) # Show a color card show("#ff5733") # Make a rainbow puts gradient(:linear, %w[red orange yellow green blue purple], direction: "to right").rasterize(width: 60).to_ansi RUBY "#{link}\n\n#{code}" end |
#to_s ⇒ String
Returns The rendered help text.
40 41 42 |
# File 'lib/unmagic/color/console/help.rb', line 40 def to_s render end |