Function: teamColors()
teamColors(
o): (datum) =>string
Defined in: packages/sdvplot/src/nivo.ts:357
A nivo colors accessor: each datum's team colour. A Bump series and a Chord arc are read by id; for a SwarmPlot
pass by: "<team field>". With background (and teams), every colour keeps 3:1 contrast against it (dark mode)
and aims to stay distinct from the others (when it cannot, it keeps the readable colour and warns once).
Parameters
o
Returns
(datum) => string
Example
import { loadLeague } from "@sportsdataverse/sdvplot";
import { teamColors } from "@sportsdataverse/sdvplot/nivo";
await loadLeague("nfl");
const colors = teamColors({ league: "nfl", teams: ["KC", "LAC", "DEN", "LV"], background: "#181a1b" });
["KC", "LAC", "DEN", "LV"].map((id) => colors({ id }));