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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# 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 colors parse("#ff5733") rgb(255, 87, 51) hsl(9, 100, 60) oklch(0.65, 0.22, 30) parse("rebeccapurple") # Manipulate colors color = parse("#ff5733") color.lighten(0.1) color.darken(0.1) color.saturate(0.1) color.desaturate(0.1) color.rotate(30) # Convert between formats color.to_rgb color.to_hsl color.to_oklch color.to_hex color.to_css_oklch # Create gradients gradient(:linear, ["#FF0000", "#0000FF"]).rasterize(width: 10).pixels[0].map(&:to_hex) # Helpers rgb(255, 87, 51) hsl(9, 100, 60) oklch(0.65, 0.22, 30) parse("#ff5733") gradient(:linear, ["#FF0000", "#0000FF"]) percentage(50) RUBY "#{link}\n\n#{code}" end |
#to_s ⇒ String
Returns The rendered help text.
58 59 60 |
# File 'lib/unmagic/color/console/help.rb', line 58 def to_s render end |