Skip to main content

Function: teamColorPalette()

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

Defined in: packages/sdvplot/src/three/tube.ts:40

One colour per team, in order, for each team's mesh material (a Trajectory's color, a MeshBasicMaterial's color). With background, every colour keeps 3:1 contrast against it (dark mode) and the teams aim to stay distinct (when they cannot, it keeps the readable colour and warns once). A team listed twice gets one colour.

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?​

ThreeColorOptions = {}

Returns​

string[]

Example​

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

await loadLeague("mlb");
teamColorPalette("mlb", ["NYY", "CWS"], { background: "#395d33" }); // readable on sporty's baseball grass