Class: Unmagic::Color::Console::Card
- Inherits:
-
Object
- Object
- Unmagic::Color::Console::Card
- Defined in:
- lib/unmagic/color/console/card.rb
Overview
Renders a comprehensive “profile card” for a color.
Displays the color’s values in all color spaces (RGB, HSL, OKLCH), harmony colors, and variations (shades, tints, tones).
Constant Summary collapse
- WIDTH =
Width of the card in characters (excluding box borders)
72
Instance Method Summary collapse
-
#initialize(color) ⇒ Card
constructor
A new instance of Card.
-
#render ⇒ String
Render the color profile card as a string.
-
#to_s ⇒ String
The rendered card.
Constructor Details
#initialize(color) ⇒ Card
Returns a new instance of Card.
25 26 27 28 |
# File 'lib/unmagic/color/console/card.rb', line 25 def initialize(color) @color = Color.parse(color) @highlighter = Highlighter.new end |
Instance Method Details
#render ⇒ String
Render the color profile card as a string.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/unmagic/color/console/card.rb', line 33 def render lines = [] lines << top_border lines.concat(header_rows) lines << separator lines.concat(harmony_rows) lines << separator lines.concat(variation_rows) lines << bottom_border lines.join("\n") end |
#to_s ⇒ String
Returns The rendered card.
46 47 48 |
# File 'lib/unmagic/color/console/card.rb', line 46 def to_s render end |