diagram_core/src/render/theme.rs#
Source: lib/diagram_core/src/render/theme.rs
theme -- what the viewer needs of a DrawingML theme with Visio's extensions (JD4)
ThemeInfo::parse(bytes) colours (dk1, lt1, dk2, lt2, accent1-6, hlink, folHlink),
the variation colours (vt:variationClrScheme, 7 each), the
background (vt:bkgnd), the major and minor Latin fonts, the
line widths of the format scheme, and the scheme IDs
(vt:schemeID schemeEnum) a page's ThemeIndex and
ColorSchemeIndex cells point at
ThemeInfo::quick_color(index, variation) a QuickStyle colour index -> RGB
Pages do not name their theme by a relationship: Visio keeps all themes at the document and
a page picks one by the schemeEnum of its ThemeIndex (the theme), ColorSchemeIndex (the
colours) and FontSchemeIndex (the fonts) cells (JD3, finding). The viewer draws the cached
values; a theme is needed only where a value is literally "Themed" (the Theme style and a few
shapes) and for the theme's background. A small tolerant scanner reads the part: elements,
attributes, nothing else; anything it does not understand is skipped.
struct ThemeInfothe parts of a theme the viewer usesname: String-- a:theme namecolors: [Option<u32>; 12]-- 0xRRGGBB of dk1, lt1, dk2, lt2, accent1 .. accent6, hlink, folHlink (None: not given)variations: Vec<[Option<u32>; 7]>-- the variation colour schemes, 7 colours eachbackground: Option<u32>-- vt:bkgndmajor_font: String-- the Latin typefaces of the major (headings) and minor (body) fontsminor_font: Stringline_widths: Vec<f64>-- a:lnStyleLst widths in inches (the line style matrix 1, 2, 3 ...)scheme_ids: [Option<u32>; 4]-- the schemeEnum of the colour scheme, the font scheme, the format scheme and the theme as a whole (vt:themeScheme), in that order; every other schemeID found after themother_ids: Vec<u32>
impl ThemeInfo
fn parse(data: &[u8]) -> Option<ThemeInfo>the theme of a theme part (None: not a theme)fn has_scheme(&self, id: u32) -> boolwhether the theme's own scheme (vt:themeScheme), or else any of its schemes, has this IDfn color(&self, i: usize) -> u32a scheme colour 0 .. 11 (dk1, lt1, dk2, lt2, accent1-6, hlink, folHlink)fn quick_color(&self, index: u32, variation: usize) -> Option<u32>a QuickStyle colour index (QuickStyleLineColor, ...FillColor, ...FontColor): 0 dark 1, 1 light 1, 2 to 7 accent 1 to 6, 8 dark 2, 9 light 2, 100 to 106 the variation colours 1 to 7 ofvariation, 200 the backgroundfn no_theme_color(index: u32) -> u32QuickStyle colours without a theme