Class: AsciidoctorDiagramLayout::Renderer::Scheme::MonochromaticScheme
- Inherits:
-
Object
- Object
- AsciidoctorDiagramLayout::Renderer::Scheme::MonochromaticScheme
- Includes:
- ColorScheme
- Defined in:
- lib/asciidoctor_diagram_layout/renderer/scheme/monochromatic_scheme.rb
Overview
Varies only lightness while keeping hue and saturation fixed.
Produces a single-color palette with subtle brightness differences between cells.
Constant Summary collapse
- LIGHTNESS_MIN =
:nodoc:
75- LIGHTNESS_MAX =
:nodoc:
95- GRADIENT_SHIFT =
:nodoc:
5- STROKE_LIGHTNESS =
:nodoc:
60- STROKE_SATURATION =
:nodoc:
20
Instance Method Summary collapse
-
#fill_color(name) ⇒ Object
:nodoc:.
-
#gradient_end(name) ⇒ Object
:nodoc:.
-
#initialize(hue, saturation) ⇒ MonochromaticScheme
constructor
A new instance of MonochromaticScheme.
-
#stroke_color(name) ⇒ Object
:nodoc:.
Constructor Details
#initialize(hue, saturation) ⇒ MonochromaticScheme
Returns a new instance of MonochromaticScheme.
21 22 23 24 |
# File 'lib/asciidoctor_diagram_layout/renderer/scheme/monochromatic_scheme.rb', line 21 def initialize(hue, saturation) @hue = hue @saturation = saturation end |
Instance Method Details
#fill_color(name) ⇒ Object
:nodoc:
27 28 29 |
# File 'lib/asciidoctor_diagram_layout/renderer/scheme/monochromatic_scheme.rb', line 27 def fill_color(name) ColorPalette.hsl_to_hex(@hue, @saturation, lightness(name)) end |
#gradient_end(name) ⇒ Object
:nodoc:
32 33 34 35 |
# File 'lib/asciidoctor_diagram_layout/renderer/scheme/monochromatic_scheme.rb', line 32 def gradient_end(name) l = [lightness(name) + GRADIENT_SHIFT, 98].min ColorPalette.hsl_to_hex(@hue, @saturation, l) end |
#stroke_color(name) ⇒ Object
:nodoc:
38 39 40 |
# File 'lib/asciidoctor_diagram_layout/renderer/scheme/monochromatic_scheme.rb', line 38 def stroke_color(name) ColorPalette.hsl_to_hex(@hue, STROKE_SATURATION, STROKE_LIGHTNESS) end |