Class: Abachrome::Converters::OklabToSrgb
- Defined in:
- lib/abachrome/converters/oklab_to_srgb.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.convert(oklab_color) ⇒ Color
Converts a color from the Oklab color space to the sRGB color space.
Methods inherited from Base
#can_convert?, #convert, find_converter, #initialize, raise_unless, register
Constructor Details
This class inherits a constructor from Abachrome::Converters::Base
Class Method Details
.convert(oklab_color) ⇒ Color
Converts a color from the Oklab color space to the sRGB color space. This conversion is performed in two steps:
-
First converts from Oklab to linear RGB
-
Then converts from linear RGB to sRGB
31 32 33 34 35 36 37 38 39 |
# File 'lib/abachrome/converters/oklab_to_srgb.rb', line 31 def self.convert(oklab_color) raise_unless oklab_color, :oklab # First convert Oklab to linear RGB lrgb_color = OklabToLrgb.convert(oklab_color) # Then use the LrgbToSrgb converter to go from linear RGB to sRGB LrgbToSrgb.convert(lrgb_color) end |