Skip to main content

Function: tableThemeSpec()

tableThemeSpec(name, mode?): TableThemeSpec

Defined in: packages/sdvtables/src/themes/registry.ts:295

Resolve a surveyed registry theme (e.g. datagolf, wikipedia, nejm) to its fonts, sizes, palette and structure, as Python's table_theme_spec does. Pass it, resolved in the same mode, as perspectiveConfig's theme (@sportsdataverse/sdvplot/perspective).

Parameters​

name​

string

the theme id, as listTableThemes() lists it. "espn", "fivethirtyeight" and "pff" are reactablefmtr ports (the fmtr-espn theme and so on), not registry ids; the surveyed look of those sites is "espn-site" and so on.

mode?​

"dark" | "light"

"light" (default) or "dark".

Returns​

TableThemeSpec

a new spec on every call: changing one changes no other.

Throws​

TableSpecError for an unknown mode, an unknown name (with up to 3 close matches), a reactablefmtr name, or "dark" on a light-only theme (naming three dark-capable themes in its category).

Example​

import { tableThemeSpec } from "@sportsdataverse/sdvtables";

const spec = tableThemeSpec("datagolf", "dark");
[spec.palette.bg, spec.fonts.body, spec.sizes.body];