public class XSSFColor extends ExtendedColor
| Constructor and Description |
|---|
XSSFColor() |
XSSFColor(byte[] rgb) |
XSSFColor(byte[] rgb,
IndexedColorMap colorMap) |
XSSFColor(java.awt.Color clr,
IndexedColorMap map)
TEST ONLY
|
XSSFColor(IndexedColorMap colorMap)
new color with the given indexed color map
|
XSSFColor(IndexedColors indexedColor,
IndexedColorMap colorMap) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
static XSSFColor |
from(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color) |
static XSSFColor |
from(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color,
IndexedColorMap map) |
byte[] |
getARGB()
Standard Alpha Red Green Blue ctColor value (ARGB).
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor |
getCTColor()
Returns the underlying XML bean
|
short |
getIndex()
Indexed ctColor value.
|
short |
getIndexed() |
protected byte[] |
getIndexedRGB() |
byte[] |
getRGB()
Standard Red Green Blue ctColor value (RGB).
|
protected byte[] |
getStoredRBG() |
int |
getTheme()
Index into the
clrScheme collection, referencing a particular sysClr or
srgbClr value expressed in the Theme part. |
double |
getTint()
Specifies the tint value applied to the ctColor.
|
boolean |
hasAlpha() |
int |
hashCode() |
boolean |
hasTint() |
boolean |
isAuto()
A boolean value indicating the ctColor is automatic and system ctColor dependent.
|
boolean |
isIndexed()
A boolean value indicating the ctColor is Indexed
|
boolean |
isRGB() |
boolean |
isThemed() |
void |
setAuto(boolean auto) |
void |
setIndexed(int indexed)
Indexed ctColor value.
|
void |
setRGB(byte[] rgb)
Standard Alpha Red Green Blue ctColor value (ARGB).
|
void |
setTheme(int theme)
Index into the
clrScheme collection, referencing a particular sysClr or
srgbClr value expressed in the Theme part. |
void |
setTint(double tint)
Specifies the tint value applied to the ctColor.
|
static XSSFColor |
toXSSFColor(Color color)
Checked type cast
color to an XSSFColor. |
getARGBHex, getRGBOrARGB, getRGBWithTint, setARGBHex, setColorpublic XSSFColor()
public XSSFColor(IndexedColorMap colorMap)
colorMap - The IndexedColorMap to use instead of the default one (can be null)public XSSFColor(java.awt.Color clr,
IndexedColorMap map)
clr - awt Colormap - The IndexedColorMap to use instead of the default one (can be null)public XSSFColor(byte[] rgb,
IndexedColorMap colorMap)
rgb - The RGB-byte-values for the ColorcolorMap - The IndexedColorMap to use instead of the default one (can be null)public XSSFColor(byte[] rgb)
rgb - The RGB-byte-values for the Colorpublic XSSFColor(IndexedColors indexedColor, IndexedColorMap colorMap)
indexedColor - color index (Enum named for default colors)colorMap - The IndexedColorMap to use instead of the default onepublic static XSSFColor from(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color, IndexedColorMap map)
color - The ooxml color object to usemap - The IndexedColorMap to use instead of the default one (can be null)public static XSSFColor from(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor color)
color - The ooxml color object to usepublic boolean isAuto()
isAuto in class ExtendedColorpublic void setAuto(boolean auto)
auto - true if the ctColor is automatic and system ctColor dependent.public boolean isIndexed()
isIndexed in class ExtendedColorpublic boolean isRGB()
isRGB in class ExtendedColorpublic boolean isThemed()
isThemed in class ExtendedColorpublic boolean hasAlpha()
public boolean hasTint()
public short getIndex()
getIndex in class ExtendedColorExtendedColor.isIndexed() is truepublic short getIndexed()
public void setIndexed(int indexed)
indexed - color indexpublic byte[] getRGB()
getRGB in class ExtendedColorpublic byte[] getARGB()
getARGB in class ExtendedColorprotected byte[] getStoredRBG()
getStoredRBG in class ExtendedColorprotected byte[] getIndexedRGB()
getIndexedRGB in class ExtendedColorExtendedColor.isIndexed() == true, null if not indexed or index is invalidpublic void setRGB(byte[] rgb)
setRGB in class ExtendedColorrgb - bytespublic int getTheme()
clrScheme collection, referencing a particular sysClr or
srgbClr value expressed in the Theme part.getTheme in class ExtendedColorExtendedColor.isThemed() is truepublic void setTheme(int theme)
clrScheme collection, referencing a particular sysClr or
srgbClr value expressed in the Theme part.theme - indexpublic double getTint()
If tint is supplied, then it is applied to the RGB value of the ctColor to determine the final ctColor applied.
The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change.
In loading the RGB value, it is converted to HLS where HLS values are (0..HLSMAX), where HLSMAX is currently 255.
Here are some examples of how to apply tint to ctColor:If (tint < 0) Lum' = Lum * (1.0 + tint) For example: Lum = 200; tint = -0.5; Darken 50% Lum' = 200 * (0.5) => 100 For example: Lum = 200; tint = -1.0; Darken 100% (make black) Lum' = 200 * (1.0-1.0) => 0 If (tint > 0) Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint)) For example: Lum = 100; tint = 0.75; Lighten 75% Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75)) = 100 * .25 + (255 - 255 * .25) = 25 + (255 - 63) = 25 + 192 = 217 For example: Lum = 100; tint = 1.0; Lighten 100% (make white) Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1)) = 100 * 0 + (255 - 255 * 0) = 0 + (255 - 0) = 255
getTint in class ExtendedColorpublic void setTint(double tint)
If tint is supplied, then it is applied to the RGB value of the ctColor to determine the final ctColor applied.
The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change.
In loading the RGB value, it is converted to HLS where HLS values are (0..HLSMAX), where HLSMAX is currently 255.
Here are some examples of how to apply tint to ctColor:If (tint < 0) Lum' = Lum * (1.0 + tint) For example: Lum = 200; tint = -0.5; Darken 50% Lum' = 200 * (0.5) => 100 For example: Lum = 200; tint = -1.0; Darken 100% (make black) Lum' = 200 * (1.0-1.0) => 0 If (tint > 0) Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint)) For example: Lum = 100; tint = 0.75; Lighten 75% Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75)) = 100 * .25 + (255 - 255 * .25) = 25 + (255 - 63) = 25 + 192 = 217 For example: Lum = 100; tint = 1.0; Lighten 100% (make white) Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1)) = 100 * 0 + (255 - 255 * 0) = 0 + (255 - 0) = 255
setTint in class ExtendedColortint - the tint value@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor getCTColor()
public static XSSFColor toXSSFColor(Color color)
color to an XSSFColor.color - the color to type castjava.lang.IllegalArgumentException - if color is null or is not an instance of XSSFColorpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.ObjectCopyright 2022 The Apache Software Foundation or its licensors, as applicable.