Color

Overview

Data type

A color.

Color is based on the RGB color model (e.g., see Wikipedia for an overview). For each channel red, green, and blue, Color has an attribute R, G, and B that gives the intensity of the channel. Intensities are given as values of UnsignedByte, i.e., integers in the range [0, 255].

Attributes (data)

Name

Multiplicity

Type

B

1

UnsignedByte

G

1

UnsignedByte

R

1

UnsignedByte

Simplified Literals

Within this specification, we use the hexadecimal SVG representation of a Color (without the string delimiters) as a convenient literal to refer to that Color.

For example, #0000ff refers to the Color blue with R=0, G=0, and B=255.

Mapping to SVG

There are several syntactical variants to map a Color to SVG. Here, we use the RGB Hexadecimal Notation with 6 digits as defined by [CSS Color 4]. It has the form '#RRGGBB', where RR, GG, and BB are 2-digit hexadecimal representations of the integer values of the attributes R, G, and B. Conventional hexadecimal digits are used: 0, …, 9, a, …, f. Capitalized versions of the latter are also allowed: A, …, F. To ensure 2 digits for each integer, a leading zero is added if required.

Consider the Color with R=0, G=10, and B=255.

The hexadecimal representations of the attributes are 00, 0a, and ff.

Hence, the SVG representation of the color is '#000aff'.

B

Attribute (data)

The intensity of the blue channel of the Color.

Multiplicity: 1

G

Attribute (data)

The intensity of the green channel of the Color.

Multiplicity: 1

R

Attribute (data)

The intensity of the red channel of the Color.

Multiplicity: 1