JFLib

diagram_core/src/formula/theme.rs#

Source: lib/diagram_core/src/formula/theme.rs

theme -- THEMEVAL and its relatives over the document's themes (FX-08, TH-01)

A document keeps its theme parts as a pool (Document::themes); a sheet picks five parts of
them by number ([MS-VSDX] 2.2.7.4): ColorSchemeIndex the colour scheme, FontSchemeIndex the
font scheme, EffectSchemeIndex the format scheme (fill, line and effect style lists),
ConnectorSchemeIndex the connector scheme, ThemeIndex the theme as a whole -- each the
component whose vt:schemeID schemeEnum has that number, in any part.  65534 means "the
page's value", 0 no theme (also when any of the five is 0; a master has no page, so its
shapes are unthemed).

Within the components the shape's quick style cells choose: QuickStyleLineColor /
FillColor / ShadowColor / FontColor a colour (0 dk1, 1 lt1, 2..7 accent1..6, 8 background,
100..106 the variant colours of VariationColorIndex), QuickStyleLineMatrix / FillMatrix /
EffectsMatrix / FontMatrix an entry of the style lists (1..6; 100..103 the variant style of
VariationStyleIndex; 0 the root style sheet).  A DrawingML style colours its placeholder
(phClr) with the chosen colour, through the modifiers it carries (lumMod, satMod, tint ...).

  THEMEVAL()               the theme's value for the cell it stands in: V stores "Themed"
  THEMEVAL(name [,dflt])   a named value (colours, line, fill, shadow, font properties);
                           unthemed: dflt, else the "No Theme" colour or the root style's
                           cell; numbers name quick style colours (THEMEVAL(QuickStyleFillColor))
  THEMEPROP("MultiFormat" | "Embellishment"), ISTHEMED(), CELLISTHEMED(b), THEMERESTORE(x)

Settled in JD11 (jd11-research-estimates.md: [MS-VSDX], Office's notes, a Visio 16 file
with computed theme values): FillColor2 is the fill colour slice itself, without the fill
style's transforms (also for gradients); Visio's vt:lineStyles lists lead with an entry for
matrix 0 (the root style's), so matrix i reads entry i; the "Connector..." names choose the
scheme as the "Line..." ones do; cap rnd 0, flat 1, sq 2, a missing cap is flat; compound
sng 0, dbl 1, thickThin 2, thinThick 3, tri 4; colour transforms chain in floating point and
round once.  Still estimated: text takes the minor font (the major one when the minor is
empty; Visio's own themes have both equal).  design::apply applies themes.
  • struct Theme a theme part read for formulas: its element tree and the components it carries
    • tree: Tree -- the element tree

impl Theme

  • fn parse(data: &[u8]) -> Theme read a theme part
  • fn scheme_ids(&self) -> [Option<u32>; 5] the scheme numbers of its components: the theme (vt:themeScheme), the colours, the format scheme (vt:fmtSchemeEx), the connector scheme, the fonts -- in the order of the cells ThemeIndex, ColorSchemeIndex, EffectSchemeIndex, ConnectorSchemeIndex, FontSchemeIndex

Source: docs/API.md in the JFLib repository.