Class: AsciidoctorDiagramLayout::Renderer::Scheme::GoldenRatioScheme
- Inherits:
-
Object
- Object
- AsciidoctorDiagramLayout::Renderer::Scheme::GoldenRatioScheme
- Includes:
- ColorScheme
- Defined in:
- lib/asciidoctor_diagram_layout/renderer/scheme/golden_ratio_scheme.rb
Overview
Spreads hues across the full 360-degree range using the golden ratio.
Each cell name’s Java hash determines its position on the hue circle, ensuring visually distinct colors for adjacent names.
Constant Summary collapse
- GRADIENT_HUE_SHIFT =
:nodoc:
20- STROKE_LIGHTNESS =
:nodoc:
65- STROKE_SATURATION =
:nodoc:
30
Instance Method Summary collapse
-
#fill_color(name) ⇒ Object
:nodoc:.
-
#gradient_end(name) ⇒ Object
:nodoc:.
-
#initialize(saturation, lightness) ⇒ GoldenRatioScheme
constructor
A new instance of GoldenRatioScheme.
-
#stroke_color(name) ⇒ Object
:nodoc:.
Constructor Details
#initialize(saturation, lightness) ⇒ GoldenRatioScheme
Returns a new instance of GoldenRatioScheme.
19 20 21 22 |
# File 'lib/asciidoctor_diagram_layout/renderer/scheme/golden_ratio_scheme.rb', line 19 def initialize(saturation, lightness) @saturation = saturation @lightness = lightness end |
Instance Method Details
#fill_color(name) ⇒ Object
:nodoc:
25 26 27 |
# File 'lib/asciidoctor_diagram_layout/renderer/scheme/golden_ratio_scheme.rb', line 25 def fill_color(name) ColorPalette.hsl_to_hex(hue(name), @saturation, @lightness) end |
#gradient_end(name) ⇒ Object
:nodoc:
30 31 32 33 |
# File 'lib/asciidoctor_diagram_layout/renderer/scheme/golden_ratio_scheme.rb', line 30 def gradient_end(name) ColorPalette.hsl_to_hex((hue(name) + GRADIENT_HUE_SHIFT) % ColorPalette::HUE_RANGE, @saturation, @lightness) end |
#stroke_color(name) ⇒ Object
:nodoc:
36 37 38 |
# File 'lib/asciidoctor_diagram_layout/renderer/scheme/golden_ratio_scheme.rb', line 36 def stroke_color(name) ColorPalette.hsl_to_hex(hue(name), STROKE_SATURATION, STROKE_LIGHTNESS) end |