Function: themePreview()
themePreview<
Row>(spec,rows,themes?,o?):Record<string,string>
Defined in: packages/sdvtables/src/html/index.ts:142
gt_theme_preview (_themes.py:2058-2064): one HTML string per theme, first n rows, compact; sdvTeam shown with league nfl and no team.
Type Parameters
Row
Row
Parameters
spec
TableSpec<Row>
rows
readonly Row[]
themes?
readonly string[]
o?
density?
n?
number
Returns
Record<string, string>
Example
import { defineTable } from "@sportsdataverse/sdvtables";
import { themePreview } from "@sportsdataverse/sdvtables/html";
const rows = [
{ team: "KC", wins: 15, losses: 2 },
{ team: "BUF", wins: 13, losses: 4 },
];
const spec = defineTable<(typeof rows)[number]>()
.columns((c) => [c.text("team"), c.int("wins"), c.int("losses")])
.build();
Object.values(themePreview(spec, rows, ["sdv", "athletic", "midnight"])).join("\n");