Class ColorUtils
java.lang.Object
gaiasky.util.color.ColorUtils
Utility functions related to colors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[][]Highlight color array for datasetsstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Colorstatic float[]static com.badlogic.gdx.graphics.Color -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic float[]brighten(float[] rgb, float luminosity) Returns a copy of the RGB colour brightened up by the given amountstatic float[]BVtoRGB(double bv) Converts the color index B-V to RGB model.static voidcolormap_blue_to_magenta(float value, float[] rgba) static voidcolormap_blue_white_red(float value, float[] rgba) Converts a scalar normalized to the range [0:1] into a blue-white-red rgba color, with blue at 0, white at 0.5 and red at 1.static voidcolormap_long_rainbow(float value, float[] rgba) Converts a scalar in [0..1] to a long rainbow of rgba values.static voidcolormap_short_rainbow(float value, float[] rgba) Converts a scalar normalized to the range [0:1] into a short rainbow of rgba values.static voidcolormap_yellow_to_red(float value, float[] rgba) Converts a scalar in [0..1] to a yellow to red map.static intgetBlue(int rgb) static float[]getColorFromIndex(int idx) static intgetGreen(int rgb) static intgetRed(int rgb) static float[]getRgbaComplimentary(float[] rgba) static float[]getRgbComplimentary(float[] rgb) static voidgrayscale(float value, float[] rgba) Converts a scalar value that is normalized to [0:1] into a grayscale color vector rgba.static float[]static float[]static float[]hsbToRgb(float[] hsb) static intHSBtoRGB(float hue, float saturation, float brightness) static float[]hslToRgb(float[] hsl) Converts an HSL color value to RGB.static booleanisZero(com.badlogic.gdx.graphics.Color c) static floatnormalize(float value, float min, float max) static StringrgbaToHex(float[] color) static StringrgbToHex(float[] color) static float[]rgbToHsb(float[] color) static float[]rgbToHsl(float[] rgb) Converts an RGB color value to HSL.static float[]tEffToRGB_harre(double tEff) Convert effective temperature to RGB using the Harre and Heller 2021 (Digital Color of Stars) method.static float[]tEffToRGB_rough(double tEff) Converts effective temperature in Kelvin (1000-40000) to RGB.
-
Field Details
-
gGreen
public static float[] gGreen -
gGreenC
public static com.badlogic.gdx.graphics.Color gGreenC -
gBlue
public static float[] gBlue -
gBlueC
public static com.badlogic.gdx.graphics.Color gBlueC -
gRed
public static float[] gRed -
gRedC
public static com.badlogic.gdx.graphics.Color gRedC -
gYellow
public static float[] gYellow -
gYellowC
public static com.badlogic.gdx.graphics.Color gYellowC -
gWhite
public static float[] gWhite -
gWhiteC
public static com.badlogic.gdx.graphics.Color gWhiteC -
gPink
public static float[] gPink -
gPinkC
public static com.badlogic.gdx.graphics.Color gPinkC -
aOrange
public static float[] aOrange -
aOrangeC
public static com.badlogic.gdx.graphics.Color aOrangeC -
tPurple
public static float[] tPurple -
tPurpleC
public static com.badlogic.gdx.graphics.Color tPurpleC -
ddMagenta
public static float[] ddMagenta -
ddMagentaC
public static com.badlogic.gdx.graphics.Color ddMagentaC -
ddBrown
public static float[] ddBrown -
ddBrownC
public static com.badlogic.gdx.graphics.Color ddBrownC -
oLighterGray
public static float[] oLighterGray -
oLighterGrayC
public static com.badlogic.gdx.graphics.Color oLighterGrayC -
oLightGray
public static float[] oLightGray -
oLightGrayC
public static com.badlogic.gdx.graphics.Color oLightGrayC -
oDarkGray
public static float[] oDarkGray -
oDarkGrayC
public static com.badlogic.gdx.graphics.Color oDarkGrayC -
oCyan
public static float[] oCyan -
oCyanC
public static com.badlogic.gdx.graphics.Color oCyanC -
colorArray
public static float[][] colorArrayHighlight color array for datasets
-
-
Constructor Details
-
ColorUtils
public ColorUtils()
-
-
Method Details
-
getColorFromIndex
public static float[] getColorFromIndex(int idx) -
getRgbaComplimentary
public static float[] getRgbaComplimentary(float[] rgba) -
getRgbComplimentary
public static float[] getRgbComplimentary(float[] rgb) -
rgbToHsb
public static float[] rgbToHsb(float[] color) -
hsbToRgb
public static float[] hsbToRgb(float[] hsb) -
rgbaToHex
-
rgbToHex
-
hexToRgba
-
hexToRgb
-
normalize
public static float normalize(float value, float min, float max) -
grayscale
public static void grayscale(float value, float[] rgba) Converts a scalar value that is normalized to [0:1] into a grayscale color vector rgba. See: .- Parameters:
value- The grayscale value to set to the color.rgba- The out parameter containing the color.
-
colormap_blue_white_red
public static void colormap_blue_white_red(float value, float[] rgba) Converts a scalar normalized to the range [0:1] into a blue-white-red rgba color, with blue at 0, white at 0.5 and red at 1.- Parameters:
value- The value.rgba- The out parameter containing the color.
-
colormap_short_rainbow
public static void colormap_short_rainbow(float value, float[] rgba) Converts a scalar normalized to the range [0:1] into a short rainbow of rgba values. See: .- Parameters:
value- The value.rgba- The out parameter containing the color.
-
colormap_long_rainbow
public static void colormap_long_rainbow(float value, float[] rgba) Converts a scalar in [0..1] to a long rainbow of rgba values. See here.- Parameters:
value- The value in [0..1].rgba- The out parameter containing the color.
-
colormap_yellow_to_red
public static void colormap_yellow_to_red(float value, float[] rgba) Converts a scalar in [0..1] to a yellow to red map. See here.- Parameters:
value- The value to convert.rgba- The out parameter containing the color.
-
colormap_blue_to_magenta
public static void colormap_blue_to_magenta(float value, float[] rgba) -
tEffToRGB_harre
public static float[] tEffToRGB_harre(double tEff) Convert effective temperature to RGB using the Harre and Heller 2021 (Digital Color of Stars) method.- Parameters:
tEff- The effective temperature of the star.- Returns:
- The RGB color in a float array.
- See Also:
-
tEffToRGB_rough
public static float[] tEffToRGB_rough(double tEff) Converts effective temperature in Kelvin (1000-40000) to RGB.- Parameters:
tEff- Effective temperature.- Returns:
- The RGB color in a float array.
- See Also:
-
BVtoRGB
public static float[] BVtoRGB(double bv) Converts the color index B-V to RGB model. See here- Parameters:
bv- The B-V color index- Returns:
- The RGB as a float array in [0..1]
-
brighten
public static float[] brighten(float[] rgb, float luminosity) Returns a copy of the RGB colour brightened up by the given amount- Parameters:
rgb- The RGB colorluminosity- The new luminosity amount in [0..1]- Returns:
- The new RGB array
-
rgbToHsl
public static float[] rgbToHsl(float[] rgb) Converts an RGB color value to HSL. Conversion formula adapted from here. Assumes r, g, and b are contained in the set [0..255] and returns h, s, and l in the set [0..1]- Parameters:
rgb- Float array with the RGB values- Returns:
- Array The HSL representation
-
hslToRgb
public static float[] hslToRgb(float[] hsl) Converts an HSL color value to RGB. Conversion formula adapted from here. Assumes h, s, and l are contained in the set [0..1] and returns r, g, and b in the set [0..255].- Parameters:
hsl- Float array with the HSL values- Returns:
- Array The RGB representation
-
HSBtoRGB
public static int HSBtoRGB(float hue, float saturation, float brightness) -
getRed
public static int getRed(int rgb) -
getGreen
public static int getGreen(int rgb) -
getBlue
public static int getBlue(int rgb) -
isZero
public static boolean isZero(com.badlogic.gdx.graphics.Color c)
-