Skip to content

0009 The pivot module's dark values follow the report's theme

Sources: #66, #104

Context and Problem Statement

The pivot report follows PSU's light and dark mode: it reads <html data-theme> and sets pivotkit's data-pk-theme on its own root (the header of psu.css). The Excel export reads the report's light theme. The HTML report reads both themes: it shows each on the report for a moment. A dark value written for the page's data-theme stays in force while the report shows its light theme, so it reaches the file (#104). The rule comes from pivotkit's upgrade notes for its 0.5.0 (#104).

Considered Options

  • Dark values on the page's :root[data-theme="dark"].
  • Dark values on pivotkit's [data-pk-theme="dark"] of the report.

Decision Outcome

Chosen option: pivotkit's [data-pk-theme="dark"] (#104). psu.css writes its dark defaults for that attribute and has no data-theme selector. An app's corporate dark values name both, :root[data-theme="dark"], .ud-pivot-report [data-pk-theme="dark"], as docs/pivot/themes.md shows, so one stylesheet themes the ECharts module and the report. tests/js/pivot.test.js checks psu.css and the documented stylesheet.

Consequences

  • Good: an export or HTML report from a dark app has the colours of the theme it shows; a report pinned to one theme with -Theme keeps it.
  • Bad: an app's stylesheet needs a selector for the report besides the page's, as docs/pivot/themes.md shows.