Package com.atlassian.confluence.util
Class ColourUtils
- java.lang.Object
-
- com.atlassian.confluence.util.ColourUtils
-
public class ColourUtils extends Object
Color manipulation utilities- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description ColourUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
colorToHex(Color color)
Returns hexadecimal value for a color.static Color
darken(Color color, double amount)
Returns a color darker than the given colorstatic String
darken(String hexColor, double amount)
Returns a color darker than the given colorstatic Color
desaturate(Color color, double amount)
Returns a color less saturate than the given colorstatic String
desaturate(String hexColor, double amount)
Returns a color less saturate than the given colorstatic Color
hexToColor(String hexColor)
Given a color hexadecimal value returns a Color object.static int[]
hslToRgb(float[] hsl)
Returns the color value in the RGB spacestatic Color
lighten(Color color, double amount)
Returns a color lighter than the given colorstatic String
lighten(String hexColor, double amount)
Returns a color lighter than the given colorstatic Color
saturate(Color color, double amount)
Returns a color more saturated than the given colorstatic String
saturate(String hexColor, double amount)
Returns a color more saturated than the given colorstatic float[]
toHSL(Color color)
Returns the color value in the HSL space
-
-
-
Field Detail
-
EPSILON
public static final Double EPSILON
-
-
Method Detail
-
colorToHex
public static String colorToHex(Color color)
Returns hexadecimal value for a color.- Parameters:
color
- color object- Returns:
- color hexadecimal value
-
hexToColor
public static Color hexToColor(String hexColor)
Given a color hexadecimal value returns a Color object.- Parameters:
hexColor
- color hexadecimal value- Returns:
- Color object
-
darken
public static String darken(String hexColor, double amount)
Returns a color darker than the given color- Parameters:
hexColor
- color hexadecimal valueamount
- value between 0 and 100.- Returns:
- darker color
-
lighten
public static String lighten(String hexColor, double amount)
Returns a color lighter than the given color- Parameters:
hexColor
- color hexadecimal valueamount
- value between 0 and 100.- Returns:
- lighter color
-
saturate
public static String saturate(String hexColor, double amount)
Returns a color more saturated than the given color- Parameters:
hexColor
- color hexadecimal valueamount
- value between 0 and 100.- Returns:
- saturated color
-
desaturate
public static String desaturate(String hexColor, double amount)
Returns a color less saturate than the given color- Parameters:
hexColor
- color hexadecimal valueamount
- value between 0 and 100.- Returns:
- desaturated color
-
darken
public static Color darken(Color color, double amount)
Returns a color darker than the given color- Parameters:
color
- color onjectamount
- value between 0 and 100.- Returns:
- darker color
-
lighten
public static Color lighten(Color color, double amount)
Returns a color lighter than the given color- Parameters:
color
- color objectamount
- value between 0 and 100.- Returns:
- lighter color
-
desaturate
public static Color desaturate(Color color, double amount)
Returns a color less saturate than the given color- Parameters:
color
- color objectamount
- value between 0 and 100.- Returns:
- desaturated color
-
saturate
public static Color saturate(Color color, double amount)
Returns a color more saturated than the given color- Parameters:
color
- color objectamount
- value between 0 and 100.- Returns:
- saturated color
-
toHSL
public static float[] toHSL(Color color)
Returns the color value in the HSL space- Parameters:
color
- color object- Returns:
- { hue, saturation, lightness, alpha }
-
hslToRgb
public static int[] hslToRgb(float[] hsl)
Returns the color value in the RGB space- Parameters:
hsl
- color in hsl space- Returns:
- rgb values [0, 255]
-
-