All SVG colors are specified in the sRGB color space (see [SRGB]). At a minimum, SVG user agents shall conform to the color behavior requirements specified in the color units section and the minimal gamma correction rules defined in the CSS2 specification.
Additionally, SVG content can specify an alternate color specification using an ICC profile (see [ICC32]). If ICC-based colors are provided and the SVG user agent supports ICC color, then the ICC-based color takes precedence over the sRGB color specification. Note that color interpolation occurs in an RGB color space even if an ICC-based color specification is provided (see 'color-interpolation').
The 'color' property is used to provide a potential indirect value (currentColor) for the 'fill', 'stroke', 'stop-color', 'flood-color', 'lighting-color' properties.
Value: | <color> | inherit |
Initial: | depends on user agent |
Applies to: | elements to which properties 'fill', 'stroke', 'stop-color', 'flood-color', 'lighting-color' apply |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Animatable: | yes |
Except for any additional information provided in this specification, the normative definition of the property is in [CSS2].
<!ELEMENT solidColor (%descTitleMetadata;,(stop|animate|set| animateTransform|animateColor|animateMotion| %solidExt;)*)> <!ATTLIST solidColor %stdAttrs; class %ClassList; #IMPLIED style %StyleSheet; #IMPLIED %PresentationAttributes-SolidColor;> |
The 'solid-color' property indicates what color to use for this 'solidColor' element. The keyword currentColor and ICC colors can be specified in the same manner as within a <paint> specification for the 'fill' and 'stroke' properties.
Value: |
currentColor | <color> [icc-color(<name>[,<icccolorvalue>]*)] | inherit |
Initial: | black |
Applies to: | 'solidColor' elements |
Inherited: | no |
Percentages: | N/A |
Media: | visual |
Animatable: | yes |
The 'solid-opacity' property defines the opacity of a given solid color.
Value: | <alphavalue> | inherit |
Initial: | 1 |
Applies to: | 'solidColor' elements |
Inherited: | no |
Percentages: | N/A |
Media: | visual |
Animatable: | yes |
The International Color Consortium has established a standard, the ICC Profile [ICC32], for documenting the color characteristics of input and output devices. Using these profiles, it is possible to build a transform and correct visual data for viewing on different devices.
A color profile description provides the bridge between an ICC profile and references to that ICC profile within SVG content. The color profile description is added to the user agent's list of known color profiles and then used to select the relevant profile. The color profile description contains descriptors for the location of the color profile on the Web, a name to reference the profile and information about rendering intent.
Color profile descriptions can be specified in either of the following ways:
If a color profile with the same name value has been identified by both a 'color-profile' element and @color-profile rules within a CSS style sheet, then the user agent shall first attempt to locate the profile by using the specifications in the @color-profile rules first.
<!ELEMENT color-profile (%descTitleMetadata;) > <!ATTLIST color-profile %stdAttrs; %xlinkRefAttrs; xlink:href %URI; #IMPLIED local CDATA #IMPLIED name CDATA #REQUIRED rendering-intent (auto | perceptual | relative-colorimetric | saturation | absolute-colorimetric) "auto" > |
Attribute definitions:
'rendering-intent' permits the specification of a color profile rendering intent other than the default. 'rendering-intent' is applicable primarily to color profiles corresponding to CMYK color spaces. The different options cause different methods to be used for translating colors to the color gamut of the target rendering device:
When the document is styled using CSS, the @color-profile rule can be used to specify a color profile description. The general form is:
@color-profile { <color-profile-description> }where the <color-profile-description> has the form:
descriptor: value; [...] descriptor: value;
Each @color-profile rule specifies a value for every color profile descriptor, either implicitly or explicitly. Those not given explicit values in the rule take the initial value listed with each descriptor in this specification. These descriptors apply solely within the context of the @color-profile rule in which they are defined, and do not apply to document language elements. Thus, there is no notion of which elements the descriptors apply to, or whether the values are inherited by child elements.
The following are the descriptors for a <color-profile-description>:
"local(" + <string> + ")"where <string> is the profile's unique ID as specified by International Color Consortium. (Note: Profile description fields do not represent a profile's unique ID. With current ICC proposals, the profile's unique ID is an MD5-encoded value within the profile header.)
Values: | <name> |
Initial: | undefined |
Media: | visual |
Values: |
auto | perceptual | relative-colorimetric | saturation | absolute-colorimetric |
Initial: | auto |
Media: | visual |
Animatable: | no |
See the description for the rendering-intent attribute on the 'color-profile' element.
Value: | auto | sRGB | <name> | <uri> | inherit |
Initial: | auto |
Applies to: | 'image' elements that refer to raster images |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Animatable: | yes |
Elements | Attributes | Content Model |
---|---|---|
solidColor | StdAttrs, StyleAttrs, ColorPresentationAttributes, solid-color, solid-opacity | (DescriptionElements | AnimationElements)* |
color-profile | StdAttrs, XLinkRefAttrs, xlink:href, local, name, rendering-intent | (DescriptionElements)* |
The Tiny Color Module defines identical elements to the Full Color Module. It also defines the same value for the ColorElements content set.
The following interfaces are defined below: SVGColorProfileElement, SVGColorProfileRule.
The SVGColorProfileElement interface corresponds to the 'color-profile' element.
interface SVGColorProfileElement : SVGElement, SVGURIReference, SVGRenderingIntent { attribute DOMString local; // raises DOMException on setting attribute DOMString name; // raises DOMException on setting attribute unsigned short renderingIntent; // raises DOMException on setting };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an
attempt to change the value of a readonly
attribute.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an
attempt to change the value of a readonly
attribute.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an
attempt to change the value of a readonly
attribute.
|
The SVGColorProfileRule interface represents an @color-profile rule in a CSS style sheet. An @color-profile rule identifies a ICC profile which can be referenced within a given document.
Support for the SVGColorProfileRule interface is only required in user agents that support styling with CSS.
interface SVGColorProfileRule : SVGCSSRule, SVGRenderingIntent { attribute DOMString src; // raises DOMException on setting attribute DOMString name; // raises DOMException on setting attribute unsigned short renderingIntent; // raises DOMException on setting };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an
attempt to change the value of a readonly
attribute.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an
attempt to change the value of a readonly
attribute.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an
attempt to change the value of a readonly
attribute.
|