Package com.helger.css.decl
Class CSSRGB
- java.lang.Object
-
- com.helger.css.decl.CSSRGB
-
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<CSSRGB>
,ICSSColor
,ICSSWriteable
@NotThreadSafe public class CSSRGB extends Object implements ICSSWriteable, ICSSColor, com.helger.commons.lang.ICloneable<CSSRGB>
Represents a single RGB color value (red, green, blue)- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getAsCSSString(ICSSWriterSettings aSettings, int nIndentLevel)
Get the contents of this object as a serialized CSS string for writing to an output.CSSRGBA
getAsRGBA(float fOpacity)
Convert this value to an RGBA value.CSSRGBA
getAsRGBA(String sOpacity)
Convert this value to an RGBA value.String
getAsString()
String
getBlue()
CSSRGB
getClone()
String
getGreen()
String
getRed()
int
hashCode()
CSSRGB
setBlue(String sBlue)
CSSRGB
setGreen(String sGreen)
CSSRGB
setRed(String sRed)
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.css.ICSSWriteable
getAsCSSString, getAsCSSString
-
-
-
-
Constructor Detail
-
CSSRGB
public CSSRGB(@Nonnull CSSRGB aOther)
Copy constructor- Parameters:
aOther
- The object to copy the data from. May not benull
.
-
CSSRGB
public CSSRGB(int nRed, int nGreen, int nBlue)
Constructor- Parameters:
nRed
- Red part. Is fitted to a value between 0 and 255.nGreen
- Green part. Is fitted to a value between 0 and 255.nBlue
- Blue part. Is fitted to a value between 0 and 255.
-
-
Method Detail
-
getAsRGBA
@Nonnull public CSSRGBA getAsRGBA(float fOpacity)
Convert this value to an RGBA value.- Parameters:
fOpacity
- Opacity part. Is fitted to a value between 0 and 1.- Returns:
- This value as RGBA value with the passed opacity. Never
null
. - Since:
- 3.8.3
-
getAsRGBA
@Nonnull public CSSRGBA getAsRGBA(@Nonnull @Nonempty String sOpacity)
Convert this value to an RGBA value.- Parameters:
sOpacity
- Opacity part. May neither benull
nor empty.- Returns:
- This value as RGBA value with the passed opacity. Never
null
. - Since:
- 3.8.3
-
getAsString
@Nonnull @Nonempty public String getAsString()
- Specified by:
getAsString
in interfaceICSSColor
- Returns:
- The textual representation of the color.
- Since:
- 3.8.3
-
getAsCSSString
@Nonnull @Nonempty public String getAsCSSString(@Nonnull ICSSWriterSettings aSettings, @Nonnegative int nIndentLevel)
Description copied from interface:ICSSWriteable
Get the contents of this object as a serialized CSS string for writing to an output.- Specified by:
getAsCSSString
in interfaceICSSWriteable
- Parameters:
aSettings
- The settings to be used to format the output. May not benull
.nIndentLevel
- The current indentation level- Returns:
- The content of this object as CSS string. Never
null
.
-
getClone
@Nonnull public CSSRGB getClone()
- Specified by:
getClone
in interfacecom.helger.commons.lang.ICloneable<CSSRGB>
- Since:
- 3.8.3
-
-