Package de.larsgrefer.sass.embedded.util
Class CssColorSpecUtil
- java.lang.Object
-
- de.larsgrefer.sass.embedded.util.CssColorSpecUtil
-
public final class CssColorSpecUtil extends Object
This class contains the color-conversion algorithms found in the CSS Color Specification.- See Also:
- CSS Color Module Level 4
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
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:
- 8.1. Converting HSL Colors to sRGB
-
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:
- 8.2. Converting sRGB Colors to HSL
-
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:
- 9.1. Converting HWB Colors to sRGB
-
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:
- 9.2. Converting sRGB Colors to HWB
-
-