Skip to main content

team_colors

team_colors(
teams: Any,
league: str,
which: str = 'primary',
season: Any = None,
) -> Any

One "#hex" (or None) per team value, in the same container the values came in.

Arguments​

NameTypeDescription
teamsAnyA scalar, list/tuple, numpy array, or pandas/polars Series of team identifiers.
leaguestrThe SDV league key, e.g. "nfl".
whichstr"primary" or "secondary".
seasonAnyOne season, or one per team, for values reused across eras.

Returns​

str | list | Series | None: The hex color for each team, None where a team does not resolve or has no color.

Raises​

  • TypeError: If teams is not a scalar, list, tuple, numpy array, or pandas/polars Series.
  • ValueError: If league is unknown, which is not "primary"/"secondary", or season is not a year (or a list whose length does not match the teams).

Example​

import sdvplot

sdvplot.team_colors(["KC", "SF"], "nfl") # ['#e31837', '#aa0000']
sdvplot.team_colors("KC", "nfl", "secondary") # '#ffb612'

See also​