@Immutable public class CssColor extends Object implements Serializable
 CssColor.valueOf("#ff0000");
 CssColor.valueOf("orange");
 | Constructor and Description | 
|---|
CssColor(double red,
        double green,
        double blue,
        double alpha)
A new CSS color with the given red, green, blue, and alpha channel. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
equals(Object obj)  | 
double | 
getAlpha()  | 
double | 
getBlue()  | 
double | 
getGreen()  | 
double | 
getRed()  | 
boolean | 
hasAlpha()  | 
int | 
hashCode()  | 
boolean | 
isTransparent()  | 
double | 
norm1(CssColor other)  | 
static CssColor | 
ofHex(long hexCode)  | 
static CssColor | 
ofHex(String hexCode,
     CssColor defaultColor)  | 
static CssColor | 
ofRgb(double red,
     double green,
     double blue)  | 
static CssColor | 
ofRgb(int red,
     int green,
     int blue)  | 
static CssColor | 
ofRgb(String rgba,
     CssColor defaultColor)  | 
static CssColor | 
ofRgba(int red,
      int green,
      int blue,
      double alpha)  | 
static CssColor | 
ofRgba(int red,
      int green,
      int blue,
      int alpha)  | 
static CssColor | 
ofRgba(String rgba,
      CssColor defaultColor)  | 
static CssColor | 
ofRgbOrRgba(String hexCode,
           CssColor defaultColor)  | 
String | 
toClosestColorName()  | 
String | 
toCssString()  | 
String | 
toHexString()  | 
String | 
toHexString(boolean withHashTag)  | 
String | 
toNameOrHexOrRgba(double precision)  | 
String | 
toRgbaOrHexString()  | 
String | 
toRgbaString()  | 
RgbTriplet | 
toRgbTripel()  | 
String | 
toString()  | 
static CssColor | 
valueOf(String color)  | 
static CssColor | 
valueOf(String color,
       CssColor defaultColor)  | 
static CssColor | 
valueOf(String color,
       ENamedCssColor defaultColor)  | 
CssColor | 
withAlpha(double alpha)  | 
public CssColor(double red,
                double green,
                double blue,
                double alpha)
red - Red channel, 0 to 1.green - Green channel, 0 to 1.blue - Blue channel, 0 to 1.alpha - Alpha channel, 0 to 1.public double getAlpha()
public double getBlue()
public double getGreen()
public double getRed()
public boolean hasAlpha()
public boolean isTransparent()
public double norm1(CssColor other)
other - Another color.public String toClosestColorName()
public String toCssString()
public String toHexString()
#ff00ff.public String toHexString(boolean withHashTag)
withHashTag - If true, prepends the # hash tag.#ff00ff.public String toNameOrHexOrRgba(double precision)
precision - How close a named or hex color must lie to be considered valid.#ff00ff hex string if one is close to this color. Otherwise, returns a rgba(0,2.5,4} RGB(A) CSS
 color.public String toRgbaOrHexString()
#ff00ff hex string if one is close to this color. Otherwise, returns a
 rgba(0,2.5,4) RGB(A) CSS color.public String toRgbaString()
rgba(0,2.5,4) RGB(A) CSS color.public RgbTriplet toRgbTripel()
public CssColor withAlpha(double alpha)
alpha - New alpha value.public static CssColor ofHex(long hexCode)
hexCode - Hex code to parse.public static CssColor ofHex(String hexCode, CssColor defaultColor)
hexCode - Hex code to parse.defaultColor - Default color if hex code is invalid.public static CssColor ofRgb(double red, double green, double blue)
red - Red component, in the range [0,1].green - Green component, in the range [0,1].blue - Blue component, in the range [0,1].public static CssColor ofRgb(int red, int green, int blue)
red - Red component, in the range [0,255].green - Green component, in the range [0,255].blue - Blue component, in the range [0,255].public static CssColor ofRgba(int red, int green, int blue, double alpha)
red - Red component, in the range [0,255].green - Green component, in the range [0,255].blue - Blue component, in the range [0,255].alpha - Alpha component, in the range [0,1]. 0 is fully transparent.public static CssColor ofRgba(int red, int green, int blue, int alpha)
red - Red component, in the range [0,255].green - Green component, in the range [0,255].blue - Blue component, in the range [0,255].alpha - Alpha component, in the range [0,255]. 0 is fully transparent.public static CssColor valueOf(String color) throws IllegalArgumentException
IllegalArgumentExceptionpublic static CssColor valueOf(String color, ENamedCssColor defaultColor)
Copyright © 2021 XIMA MEDIA GmbH. All rights reserved.