module Sass::Value::Color::Space::Utils
def lab_to_lch(dest, lightness, a, b, alpha, # rubocop:disable Naming/MethodParameterName
-
(Color)
-
Parameters:
-
alpha
(Numeric
) -- -
b
(Numeric
) -- -
a
(Numeric
) -- -
lightness
(Numeric
) -- -
dest
(Space
) --
def lab_to_lch(dest, lightness, a, b, alpha, # rubocop:disable Naming/MethodParameterName missing_chroma: false, missing_hue: false) chroma = Math.sqrt(((a.nil? ? 0 : a)**2) + ((b.nil? ? 0 : b)**2)) hue = if missing_hue || FuzzyMath.equals(chroma, 0) nil else Math.atan2(b.nil? ? 0 : b, a.nil? ? 0 : a) * 180 / Math::PI end Color.send( :for_space_internal, dest, lightness, missing_chroma ? nil : chroma, hue.nil? || hue >= 0 ? hue : hue + 360, alpha ) end
def srgb_and_display_p3_from_linear(channel)
-
(Numeric)
-
Parameters:
-
(
Numeric
) --
def srgb_and_display_p3_from_linear(channel) abs = channel.abs abs <= 0.0031308 ? channel * 12.92 : (channel <=> 0) * ((1.055 * (abs**(1 / 2.4))) - 0.055) end
def srgb_and_display_p3_to_linear(channel)
-
(Numeric)
-
Parameters:
-
(
Numeric
) --
def srgb_and_display_p3_to_linear(channel) abs = channel.abs abs <= 0.04045 ? channel / 12.92 : (channel <=> 0) * (((abs + 0.055) / 1.055)**2.4) end