Package eu.webtoolkit.jwt
Class WColor
java.lang.Object
eu.webtoolkit.jwt.WColor
A class that specifies a color.
A color corresponds to a CSS color. You can specify a color either using its
red/green/blue components, or from a valid CSS name.
The color supports an alpha channel, which determines the degree of
transparency. An alpha value of 0 is completely transparent (and thus
invisible), while a value of 255 is completely opaque.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic WColorBlack WColor object.static WColorBlue WColor object.static WColorCyan WColor object.static WColorDark blue WColor object.static WColorDark cyan WColor object.static WColorDark gray WColor object.static WColorDark green WColor object.static WColorDark magenta WColor object.static WColorDark red WColor object.static WColorDark yellow WColor object.static WColorGray WColor object.static WColorGreen WColor object.static WColorLight gray WColor object.static WColorWhite Magenta object.static WColorRed WColor object.static WColorTransparant WColor object.static WColorWhite WColor object.static WColorYellow WColor object. -
Constructor Summary
ConstructorsConstructorDescriptionWColor()Construct a default color.WColor(int r, int g, int b) Construct a color with given red/green/blue components.WColor(int r, int g, int b, int a) Construct a color with given red/green/blue/alpha components.Construct a color from a StandardColor.WColor(CharSequence name) Construct a color from a CSS name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.static WColorfromHSL(double h, double s, double l, int alpha) intgetAlpha()Returns the alpha component.intgetBlue()Returns the blue component.final Stringfinal StringgetCssText(boolean withAlpha) intgetGreen()Returns the green component.getName()Get CSS name.intgetRed()Returns the red component.booleanReturns if the color is the default color.voidsetName(CharSequence name) Set the CSS name.final voidsetRgb(int red, int green, int blue) Set the red/green/blue components and a 255 for the alpha component.voidsetRgb(int red, int green, int blue, int alpha) Set the red/green/blue/alpha components.final voidtoHSL(double[] hsl)
-
Field Details
-
white
White WColor object. -
black
Black WColor object. -
red
Red WColor object. -
darkRed
Dark red WColor object. -
green
Green WColor object. -
darkGreen
Dark green WColor object. -
blue
Blue WColor object. -
darkBlue
Dark blue WColor object. -
cyan
Cyan WColor object. -
darkCyan
Dark cyan WColor object. -
magenta
White Magenta object. -
darkMagenta
Dark magenta WColor object. -
yellow
Yellow WColor object. -
darkYellow
Dark yellow WColor object. -
gray
Gray WColor object. -
darkGray
Dark gray WColor object. -
lightGray
Light gray WColor object. -
transparent
Transparant WColor object.
-
-
Constructor Details
-
WColor
public WColor()Construct a default color. The default color is depending on the context, another color (for example from a hierarchical parent in a widget tree), or a completely transparent color. -
WColor
Construct a color from a StandardColor. -
WColor
public WColor(int r, int g, int b, int a) Construct a color with given red/green/blue/alpha components. All four components must be specified with a value in the range (0 - 255). The alpha channel determines the degree of transparency. An alpha value of 0 is completely transparent (and thus invisible), while a value of 255 is completely opaque.- See Also:
-
WColor
public WColor(int r, int g, int b) Construct a color with given red/green/blue components. All three components must be specified with a value in the range (0 - 255). The alpha channel is defaulted to completely opaque (255).- See Also:
-
WColor
Construct a color from a CSS name. The name may be any valid CSS color name, including names colors such as "aqua", or colors defined as RGB components.In either case, the result of the methods
getRed(),getGreen()andgetBlue()is undefined.See also http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-color
-
-
Method Details
-
setRgb
public void setRgb(int red, int green, int blue, int alpha) Set the red/green/blue/alpha components. All four components must be specified with a value in the range (0 - 255). The alpha channel determines the degree of transparency. An alpha value of 0 is completely transparent (and thus invisible), while a value of 255 is completely opaque. -
setRgb
public final void setRgb(int red, int green, int blue) Set the red/green/blue components and a 255 for the alpha component.- See Also:
-
setName
Set the CSS name. The name may be any valid CSS color name, including names colors such as "aqua", or colors defined as RGB components.In either case, the result of the methods
getRed(),getGreen()andgetBlue()is undefined.See also http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-color
-
isDefault
public boolean isDefault()Returns if the color is the default color.- See Also:
-
getRed
public int getRed()Returns the red component. Only available when the color was specified in terms of the RGB components usingsetRgb(int, int, int, int)orWColor(int, int, int, int). -
getGreen
public int getGreen()Returns the green component. Only available when the color was specified in terms of the RGB components usingsetRgb(int, int, int, int)orWColor(int, int, int, int). -
getBlue
public int getBlue()Returns the blue component. Only available when the color was specified in terms of the RGB components usingsetRgb(int, int, int, int)orWColor(int, int, int, int). -
getAlpha
public int getAlpha()Returns the alpha component. Only available when the color was specified in terms of the RGB components usingsetRgb(int, int, int, int)orWColor(int, int, int, int). -
getName
Get CSS name. Only available when it was set withsetName(CharSequence name)orWColor(CharSequence name). -
equals
Indicates whether some other object is "equal to" this one. Returns true if the two colors were defined in exactly the same way. It may return false although they actually represent the same color. -
getCssText
-
getCssText
-
toHSL
public final void toHSL(double[] hsl) -
fromHSL
-