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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAsCSSString(ICSSWriterSettings aSettings, int nIndentLevel) Get the contents of this object as a serialized CSS string for writing to an output.getAsRGBA(float fOpacity) Convert this value to an RGBA value.Convert this value to an RGBA value.final StringgetBlue()getClone()final StringgetGreen()final StringgetRed()inthashCode()final CSSRGBfinal CSSRGBfinal CSSRGBtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.css.ICSSWriteable
getAsCSSString, getAsCSSString
-
Constructor Details
-
CSSRGB
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.
-
CSSRGB
public CSSRGB(@Nonnull @Nonempty String sRed, @Nonnull @Nonempty String sGreen, @Nonnull @Nonempty String sBlue) Constructor- Parameters:
sRed- Red part.sGreen- Green part.sBlue- Blue part.
-
-
Method Details
-
getRed
- Returns:
- red part
-
setRed
-
getGreen
- Returns:
- green part
-
setGreen
-
getBlue
- Returns:
- blue part
-
setBlue
-
getAsRGBA
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
Convert this value to an RGBA value.- Parameters:
sOpacity- Opacity part. May neither benullnor empty.- Returns:
- This value as RGBA value with the passed opacity. Never
null. - Since:
- 3.8.3
-
getAsString
- Specified by:
getAsStringin 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:ICSSWriteableGet the contents of this object as a serialized CSS string for writing to an output.- Specified by:
getAsCSSStringin 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
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<CSSRGB>- Since:
- 3.8.3
-
equals
-
hashCode
public int hashCode() -
toString
-