Package de.larsgrefer.sass.embedded.util
Class CssColorSpecUtil
java.lang.Object
de.larsgrefer.sass.embedded.util.CssColorSpecUtil
This class contains the color-conversion algorithms found in the CSS Color Specification.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic double[]hslToRgb(double hue, double sat, double light) Converts the given HSL color to RGB.static double[]hwbToRgb(double hue, double white, double black) Converts the given HWB color to RGB.static double[]rgbToHsl(double red, double green, double blue) Converts the given RGB color to HSL.static double[]rgbToHwb(double red, double green, double blue) Converts the given HWB color to RGB.
-
Method Details
-
hslToRgb
public static double[] hslToRgb(double hue, double sat, double light) Converts the given HSL color to RGB.- Parameters:
hue- Hue as degrees: 0..360sat- Saturation as percentage: 0..100light- Lightness as percentage: 0..100- Returns:
- Array of RGB values: 0..1
- See Also:
-
rgbToHsl
public static double[] rgbToHsl(double red, double green, double blue) Converts the given RGB color to HSL.- Parameters:
red- Red component of the color, normalized to 0..1.green- Green component of the color, normalized to 0..1.blue- Blue component of the color, normalized to 0..1.- Returns:
- Array of HSL values. Hue as degrees (0..360), Saturation and Lightness as percentages (0..100)
- See Also:
-
hwbToRgb
public static double[] hwbToRgb(double hue, double white, double black) Converts the given HWB color to RGB.- Parameters:
hue- Hue as degrees: 0..360white- Whiteness as percentage: 0..100black- Blackness as percentage: 0..100- Returns:
- Array of RGB values: 0..1
- See Also:
-
rgbToHwb
public static double[] rgbToHwb(double red, double green, double blue) Converts the given HWB color to RGB.- Parameters:
red- Red component of the color, normalized to 0..1.green- Green component of the color, normalized to 0..1.blue- Blue component of the color, normalized to 0..1.- Returns:
- Array of HWB values. Hue as degrees 0..360, Whiteness and Blackness as percentages (0..100).
- See Also:
-