Skip to main content

Function: teamColorPalette()

teamColorPalette(league, teams, o?): string[]

Defined in: packages/sdvplot/src/unovis.ts:53

One colour per team, in order: an XY component's color (one per y accessor), or anything else that takes colours by position. With background, every colour keeps 3:1 contrast against it (dark mode) and aims to stay distinct from the others. teamColorScale gives the same colours keyed by team, for accessors.

Parameters​

league​

"aaf" | "ahl" | "ajhl" | "bchl" | "cchl" | "cebl" | "cfb" | "cfl" | "chl" | "cricket" | "easl" | "echl" | "f1" | "fiba" | "gojhl" | "iihf" | "kijhl" | "lba" | "mbb" | "mhl" | "milb" | "mjhl" | "mlb" | "nba" | "nbagl" | "nbl" | "ncaa_baseball" | "ncaa_mhockey" | "ncaa_softball" | "ncaa_whockey" | "nfl" | "nhl" | "nojhl" | "ohl" | "ojhl" | "phf" | "pwhl" | "qmjhl" | "sjhl" | "soccer" | "sphl" | "ufl" | "usfl" | "ushl" | "vijhl" | "wbb" | "whl" | "wnba" | "xfl"

teams​

readonly unknown[]

o?​

UnovisColorOptions = {}

Returns​

string[]

Example​

import { loadLeague } from "@sportsdataverse/sdvplot";
import { teamColorPalette } from "@sportsdataverse/sdvplot/unovis";

await loadLeague("nfl");
// new Line({ x, y: [kc, phi], color: <this> })
teamColorPalette("nfl", ["KC", "PHI"], { background: "#111827" });