a:srgbClr (RGB Color)
Specifies a color using the sRGB (standard RGB) color model with 6-digit hexadecimal notation.
Parent elements
Child elements
Description
\:srgbClr\ defines a color using the sRGB (standard RGB) color model, a universally recognized color space. It is defined in ECMA-376 Part 1 §20.1.2.3.32.
The color value is a 6-digit hexadecimal string in format \RRGGBB:
- RR = Red component (00–FF, 0–255 in decimal)
- GG = Green component (00–FF)
- BB = Blue component (00–FF)
Common colors:
- \ 00000\ = Black
- \FFFFFF\ = White
- \FF0000\ = Pure Red
- \ 0FF00\ = Pure Green
- \ 000FF\ = Pure Blue
- \FFFF00\ = Yellow (Red + Green)
- \FF00FF\ = Magenta (Red + Blue)
- \ 0FFFF\ = Cyan (Green + Blue)
Child elements enable color modifications (transparency, tint, shade, luminance) applied to the base RGB value.
Attributes
| Attribute | Type | Range/Values | Default | Description |
|---|---|---|---|---|
| \al\ | \ST_HexColor\ | 6-digit hex (000000–FFFFFF) | (required) | RGB color value in hexadecimal. |
Content Model
\:srgbClr\ can contain color modifiers:
- \:alpha\ or \:alphaOff\ or \:alphaMod: Transparency control
- \:tint\ or \:shade: Brightness adjustment
- \:lumMod\ or \:lumOff: Luminance modification
- \:comp: Complement color
Modifiers are optional and applied in sequence.
Child Elements Table
| Element | Occurrence | Purpose |
|---|---|---|
| \:alpha\ | 0–1 | Set absolute transparency (0–100000 = 0–100%) |
| \:alphaOff\ | 0–1 | Shift alpha by offset value |
| \:alphaMod\ | 0–1 | Multiply alpha by percentage |
| \:tint\ | 0–1 | Lighten color (0–100000 = 0–100% lighter) |
| \:shade\ | 0–1 | Darken color (0–100000 = 0–100% darker) |
| \:lumMod\ | 0–1 | Modify luminance by percentage |
| \:lumOff\ | 0–1 | Offset luminance value |
Examples
Pure Red Color
<a:srgbClr val=\"FF0000\"/>
using DocumentFormat.OpenXml.Drawing;
var redColor = new RgbColorModelHex { Val = \"FF0000\" };
RGB with Transparency (50% opacity)
<a:srgbClr val=\"0070C0\">
<a:alpha val=\"50000\"/>
</a:srgbClr>
var blueColor = new RgbColorModelHex { Val = \"0070C0\" };
blueColor.Append(new Alpha { Val = 50000 }); // 50% opacity
RGB with Tint (20% lighter)
<a:srgbClr val=\"4472C4\">
<a:tint val=\"20000\"/>
</a:srgbClr>
var tintedColor = new RgbColorModelHex { Val = \"4472C4\" };
tintedColor.Append(new Tint { Val = 20000 }); // 20% lighter
RGB with Shade (30% darker)
<a:srgbClr val=\"4472C4\">
<a:shade val=\"30000\"/>
</a:srgbClr>
var shadedColor = new RgbColorModelHex { Val = \"4472C4\" };
shadedColor.Append(new Shade { Val = 30000 }); // 30% darker
RGB with Alpha Modification
<a:srgbClr val=\"FF0000\">
<a:alpha val=\"80000\"/>
<a:lumMod val=\"50000\"/>
</a:srgbClr>
var modifiedColor = new RgbColorModelHex { Val = \"FF0000\" };
modifiedColor.Append(new Alpha { Val = 80000 }); // 80% opacity
modifiedColor.Append(new LuminanceModulation { Val = 50000 }); // 50% luminance
Reference Tables
RGB Color Values (Common Colors)
| Hex Value | Color | R | G | B |
|---|---|---|---|---|
| 000000 | Black | 0 | 0 | 0 |
| FFFFFF | White | 255 | 255 | 255 |
| FF0000 | Red | 255 | 0 | 0 |
| 00FF00 | Green | 0 | 255 | 0 |
| 0000FF | Blue | 0 | 0 | 255 |
| FFFF00 | Yellow | 255 | 255 | 0 |
| FF00FF | Magenta | 255 | 0 | 255 |
| 00FFFF | Cyan | 0 | 255 | 255 |
| 808080 | Gray | 128 | 128 | 128 |
Color Modifier Values
| Modifier | Value Range | Effect |
|---|---|---|
| \:alpha\ | 0–100000 | 0% = fully transparent, 100000 = fully opaque |
| \:tint\ | 0–100000 | 0 = no change, 100000 = fully white |
| \:shade\ | 0–100000 | 0 = no change, 100000 = fully black |
| \:lumMod\ | 0–100000 | Percentage of original luminance |
| \:lumOff\ | -100000–100000 | Absolute luminance offset |
Notes
Element Relationships
- Parents: Used in solid fills, lines, effects, shadows, reference fills
- Color Hierarchy: sRGB is most specific color type; other types (scheme, system, HSL) are alternatives
- Children: All color modifiers are optional; applied in order specified
- Modification Order: Typically applied as: alpha → tint/shade → lumMod/lumOff
Implementation Details
- Hex Format: Always 6 digits; use leading zeros (e.g., 0070C0, not 70C0)
- Case Sensitivity: Hex digits typically uppercase but lowercase also valid
- Alpha Units: Value 0–100000 represents 0–100%; 50000 = 50% opacity
- Tint/Shade: Mutually exclusive within same color element
- Modifier Stacking: Multiple modifiers stack; order matters for rendering
- Transparency Composition: Alpha values can compound with parent container transparency
- Scheme Color Alternative: For theme support, prefer \:schemeClr\ for accent colors
- Compatibility: sRGB colors render identically across all Office applications and web browsers
- Performance: RGB colors slightly faster than scheme colors (no theme lookup)
- Print Fidelity: CMYK printers may show slight color shifts; RGB-to-CMYK conversion applied