java.lang.Object
io.sf.carte.doc.style.css.property.StyleValue
io.sf.carte.doc.style.css.property.PrimitiveValue
io.sf.carte.doc.style.css.property.TypedValue
io.sf.carte.doc.style.css.property.ColorValue
- All Implemented Interfaces:
CSSColorValue,CSSPrimitiveValue,CSSTypedValue,CSSValue,Serializable,Cloneable
- Direct Known Subclasses:
HSLColorValue,HWBColorValue,LABColorValue,LCHColorValue,RGBColorValue
Color value.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSColorValue
CSSColorValue.ColorModelNested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSValue
CSSValue.CssType, CSSValue.Type -
Method Summary
Modifier and TypeMethodDescriptionabstract ColorValueclone()Creates and returns a copy of this object.floatdeltaE2000(CSSColorValue color) Compute the difference to the given color, according to CIE Delta E 2000.abstract PrimitiveValuegetComponent(int index) Get the color component atindex.intGet the number of components of this value.Get a string representation of the current value.getMinifiedCssText(String propertyName) Gives a minified version of the css text of the property.booleanIs this value a wildcard for a system-dependent default?voidsetComponent(int index, StyleValue component) If this value has components, set the component atindex.voidsetCssText(String cssText) Attempts to change this value to match the supplied css text.voidConvert this value to aHSLColorValue, if possible.Convert this value to aLABColorValue, if possible.Convert this value to aLCHColorValue, if possible.voidwriteCssText(io.sf.carte.util.SimpleWriter wri) Serialize this value to aSimpleWriter.Methods inherited from class io.sf.carte.doc.style.css.property.TypedValue
getCssValueType, getFloatValue, isNumberZeroMethods inherited from class io.sf.carte.doc.style.css.property.PrimitiveValue
equals, getPrecedingComments, getPrimitiveType, getTrailingComments, hashCode, isPrimitiveValue, isSubproperty, setExpectInteger, setSubpropertyMethods inherited from class io.sf.carte.doc.style.css.property.StyleValue
matches, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.sf.carte.doc.style.css.CSSColorValue
getColor, getColorModel, toRGBColorMethods inherited from interface io.sf.carte.doc.style.css.CSSPrimitiveValue
getUnitType, isNegativeNumber, isPrimitiveValue, setExpectIntegerMethods inherited from interface io.sf.carte.doc.style.css.CSSTypedValue
getFloatValue, getFloatValue, getStringValue, isCalculatedNumber, isNumberZero, setFloatValue, setStringValue, toRGBColor, toRGBColorValueMethods inherited from interface io.sf.carte.doc.style.css.CSSValue
getCssValueType, getMinifiedCssText, getPrecedingComments, getPrimitiveType, getTrailingComments, matches
-
Method Details
-
setSystemDefault
public void setSystemDefault() -
isSystemDefault
public boolean isSystemDefault()Description copied from class:StyleValueIs this value a wildcard for a system-dependent default?If that is the case, it cannot be used to compute values.
- Overrides:
isSystemDefaultin classStyleValue- Returns:
trueif this is a placeholder for a system-dependent default,falseotherwise.
-
setCssText
Description copied from class:StyleValueAttempts to change this value to match the supplied css text.In css4j, it is not recommended to set property values using this method.
- Specified by:
setCssTextin interfaceCSSValue- Overrides:
setCssTextin classStyleValue- Parameters:
cssText- the text value.- Throws:
DOMException- SYNTAX_ERR: Raised if the specified CSS string value has a syntax error (according to the attached property) or is unparsable.
INVALID_MODIFICATION_ERR: Raised if the specified CSS string value represents a different type of values than the values allowed by the CSS property.
NO_MODIFICATION_ALLOWED_ERR: Raised if this value is read-only.
-
getCssText
Description copied from class:StyleValueGet a string representation of the current value.- Specified by:
getCssTextin interfaceCSSValue- Specified by:
getCssTextin classStyleValue- Returns:
- the css text representing the value of this property.
-
getMinifiedCssText
Description copied from interface:CSSValueGives a minified version of the css text of the property.It may be customized for the given property name.
- Specified by:
getMinifiedCssTextin interfaceCSSValue- Overrides:
getMinifiedCssTextin classStyleValue- Parameters:
propertyName- the property name.- Returns:
- the minified css text.
-
writeCssText
Description copied from interface:CSSValueSerialize this value to aSimpleWriter.- Specified by:
writeCssTextin interfaceCSSValue- Parameters:
wri- the SimpleWriter.- Throws:
IOException- if an error happened while writing.
-
deltaE2000
Description copied from interface:CSSColorValueCompute the difference to the given color, according to CIE Delta E 2000.- Specified by:
deltaE2000in interfaceCSSColorValue- Parameters:
color- the color to compute the delta from.- Returns:
- the CIE Delta E 2000.
-
setComponent
Description copied from class:TypedValueIf this value has components, set the component atindex.This method allows to access the components regardless of them being formally indexed or not. It is convenient to perform common tasks at the components (like when computing values).
- Overrides:
setComponentin classTypedValue- Parameters:
index- the index. For colors, index0is always the alpha channel. Setting a component at an index that does not exist has no effect.component- the new component. Cannot be aKEYWORDnor aSHORTHAND. For colors, must be a primitive value (that is, eitherTYPEDor aPROXY).
-
getComponent
Get the color component atindex.This method allows to access the color components like if they were indexed. It is convenient to perform common tasks at the components (like when computing values).
- Overrides:
getComponentin classTypedValue- Parameters:
index- the index. Index0is always the alpha channel.- Returns:
- the color component, or
nullif the index is incorrect.
-
getComponentCount
public int getComponentCount()Description copied from class:TypedValueGet the number of components of this value.- Overrides:
getComponentCountin classTypedValue- Returns:
- the number of components,
0if none.
-
clone
Description copied from class:TypedValueCreates and returns a copy of this object.The object will be the same except for the
subpropertyflag, that will be disabled in the clone object.- Specified by:
clonein interfaceCSSColorValue- Specified by:
clonein interfaceCSSTypedValue- Specified by:
clonein interfaceCSSValue- Specified by:
clonein classTypedValue- Returns:
- a copy of this object.
-
toHSLColorValue
Convert this value to aHSLColorValue, if possible.- Returns:
- the converted
HSLColorValue. - Throws:
DOMException- INVALID_STATE_ERR if the components cannot be converted.
-
toLABColorValue
Convert this value to aLABColorValue, if possible.- Specified by:
toLABColorValuein interfaceCSSColorValue- Returns:
- the converted
LABColorValue. - Throws:
DOMException- INVALID_STATE_ERR if the components cannot be converted.
-
toLCHColorValue
Description copied from interface:CSSColorValueConvert this value to aLCHColorValue, if possible.- Specified by:
toLCHColorValuein interfaceCSSColorValue- Returns:
- the converted
LCHColorValue. - Throws:
DOMException- INVALID_STATE_ERR if the components cannot be converted.
-