pub enum Color {
Rgb(String),
RgbPercent {
red: i64,
green: i64,
blue: i64,
},
Hsl {
hue_60000ths: i32,
saturation_1000ths_percent: i64,
luminance_1000ths_percent: i64,
},
System {
value: String,
last_color: Option<String>,
},
Preset(String),
}Expand description
A color (EG_ColorChoice): the choice DrawingML offers wherever a color is needed (fills,
lines, gradient stops..).
Not modeled: scheme-relative colors (<a:schemeClr>, ST_SchemeColorVal — a reference into a
theme’s 12-color palette) — deferred until a host crate can resolve a theme (see the project
notes plan,: excel-ooxml has no configurable Theme model at all yet, and word-ooxml’s own
Theme/Style/Run never reference a theme slot either — drawing has nothing to resolve
against today). Color transforms (EG_ColorTransform — alpha/lumMod/lumOff/shade/
tint/., applicable to every variant below) are not modeled either — each variant here is
always a literal, unmodified color.
Variants§
Rgb(String)
<a:srgbClr val="RRGGBB"> — a literal RGB color, hex-encoded with no leading #. The
overwhelmingly common case, same representation excel-ooxml/word-ooxml already use for
their own literal colors.
RgbPercent
<a:scrgbClr r=".." g=".." b=".."> — a literal RGB color given as percentages, each in
thousandths of a percent (ST_Percentage; 100000 = 100%).
Hsl
<a:hslClr hue=".." sat=".." lum="..">. hue is ST_PositiveFixedAngle (60,000ths of a
degree, 0.=21_600_000); saturation/luminance are ST_Percentage (thousandths of a
percent).
System
<a:sysClr val=".." lastClr=".."> — one of the ~30 legacy Windows UI colors
(ST_SystemColorVal, e.g. "windowText", "btnFace"). value is kept as the raw token
rather than a closed enum (rarely used in real documents, same “not enumerated” posture as
Preset below); last_color is the RGB fallback Office itself resolved it to at authoring
time.
Preset(String)
<a:prstClr val=".."> — one of ST_PresetColorVal’s ~140 CSS-like named colors (e.g.
"aliceBlue", "tomato"). Kept as the raw token rather than a closed enum, for the same
reason as Color::System — see Color::Rgb for the common, literal-hex case.