Skip to content

bigten

The bigten module provides utilities for working with Big Ten Conference institution colors.

Module Overview

This module provides:

  • Color retrieval for all 18 Big Ten institutions
  • Palette creation for comparative visualizations
  • Flexible institution name recognition
  • Institution listing functions

Functions

get_bigten_colors(institutions, color_type='primary')

Get Big Ten institutional colors.

Retrieve primary or secondary colors for one or more Big Ten institutions. Supports flexible institution name input (abbreviations, nicknames, etc.).

Args: institutions: Single institution name or list of institution names color_type: Type of color - "primary" or "secondary" (default: "primary")

Returns: If single institution: hex color string If multiple institutions: dictionary mapping institution names to colors

Raises: ValueError: If institution name not recognized or invalid color type

Examples: >>> # Single institution >>> color = get_bigten_colors("MSU") >>> print(color) '#18453B'

>>> # Multiple institutions
>>> colors = get_bigten_colors(["MSU", "Michigan", "Ohio State"])
>>> print(colors)
{'MSU': '#18453B', 'Michigan': '#FFCB05', 'Ohio State': '#BB0000'}

>>> # Using nicknames
>>> color = get_bigten_colors("Spartans")
>>> print(color)
'#18453B'

>>> # Secondary colors
>>> color = get_bigten_colors("MSU", color_type="secondary")
>>> print(color)
'#FFFFFF'
Source code in msuthemes/bigten.py
def get_bigten_colors(
    institutions: Union[str, List[str]],
    color_type: str = "primary"
) -> Union[str, Dict[str, str]]:
    """Get Big Ten institutional colors.

    Retrieve primary or secondary colors for one or more Big Ten institutions.
    Supports flexible institution name input (abbreviations, nicknames, etc.).

    Args:
        institutions: Single institution name or list of institution names
        color_type: Type of color - "primary" or "secondary" (default: "primary")

    Returns:
        If single institution: hex color string
        If multiple institutions: dictionary mapping institution names to colors

    Raises:
        ValueError: If institution name not recognized or invalid color type

    Examples:
        >>> # Single institution
        >>> color = get_bigten_colors("MSU")
        >>> print(color)
        '#18453B'

        >>> # Multiple institutions
        >>> colors = get_bigten_colors(["MSU", "Michigan", "Ohio State"])
        >>> print(colors)
        {'MSU': '#18453B', 'Michigan': '#FFCB05', 'Ohio State': '#BB0000'}

        >>> # Using nicknames
        >>> color = get_bigten_colors("Spartans")
        >>> print(color)
        '#18453B'

        >>> # Secondary colors
        >>> color = get_bigten_colors("MSU", color_type="secondary")
        >>> print(color)
        '#FFFFFF'
    """
    # Validate color type
    if color_type not in ("primary", "secondary"):
        raise ValueError(
            f"color_type must be 'primary' or 'secondary', got '{color_type}'"
        )

    # Select color dictionary
    color_dict = (
        BIGTEN_COLORS_PRIMARY if color_type == "primary"
        else BIGTEN_COLORS_SECONDARY
    )

    # Handle single institution
    if isinstance(institutions, str):
        normalized_name = normalize_institution_name(institutions)
        return color_dict[normalized_name]

    # Handle multiple institutions
    result = {}
    for inst in institutions:
        normalized_name = normalize_institution_name(inst)
        result[normalized_name] = color_dict[normalized_name]

    return result

bigten_palette(institutions=None, color_type='primary', as_palette=False)

Create a color palette from Big Ten institutional colors.

Args: institutions: List of institutions to include (default: all 18) color_type: Type of color - "primary" or "secondary" (default: "primary") as_palette: If True, return MSUPalette object; if False, return list

Returns: List of hex colors or MSUPalette object

Examples: >>> # Get all Big Ten colors >>> palette = bigten_palette() >>> print(len(palette)) 18

>>> # Get colors for specific schools
>>> palette = bigten_palette(["MSU", "Michigan", "Ohio State"])
>>> print(palette)
['#18453B', '#FFCB05', '#BB0000']

>>> # Get as MSUPalette object
>>> palette = bigten_palette(as_palette=True)
>>> colors = palette.as_hex(n_colors=5)
Source code in msuthemes/bigten.py
def bigten_palette(
    institutions: Optional[List[str]] = None,
    color_type: str = "primary",
    as_palette: bool = False
) -> Union[List[str], MSUPalette]:
    """Create a color palette from Big Ten institutional colors.

    Args:
        institutions: List of institutions to include (default: all 18)
        color_type: Type of color - "primary" or "secondary" (default: "primary")
        as_palette: If True, return MSUPalette object; if False, return list

    Returns:
        List of hex colors or MSUPalette object

    Examples:
        >>> # Get all Big Ten colors
        >>> palette = bigten_palette()
        >>> print(len(palette))
        18

        >>> # Get colors for specific schools
        >>> palette = bigten_palette(["MSU", "Michigan", "Ohio State"])
        >>> print(palette)
        ['#18453B', '#FFCB05', '#BB0000']

        >>> # Get as MSUPalette object
        >>> palette = bigten_palette(as_palette=True)
        >>> colors = palette.as_hex(n_colors=5)
    """
    # Use all institutions if not specified
    if institutions is None:
        institutions = list_bigten_institutions()

    # Get colors
    colors_dict = get_bigten_colors(institutions, color_type=color_type)

    # Extract colors in order
    if isinstance(colors_dict, str):
        colors = [colors_dict]
    else:
        colors = list(colors_dict.values())

    # Return as list or palette
    if as_palette:
        return MSUPalette(
            colors=colors,
            palette_type="qual",
            name=f"bigten_{color_type}"
        )
    return colors

list_bigten_institutions()

List all Big Ten institutions.

Returns: List of institution names in alphabetical order

Examples: >>> institutions = list_bigten_institutions() >>> print(len(institutions)) 18 >>> print(institutions[:3]) ['Illinois', 'Indiana', 'Iowa']

Source code in msuthemes/bigten.py
def list_bigten_institutions() -> List[str]:
    """List all Big Ten institutions.

    Returns:
        List of institution names in alphabetical order

    Examples:
        >>> institutions = list_bigten_institutions()
        >>> print(len(institutions))
        18
        >>> print(institutions[:3])
        ['Illinois', 'Indiana', 'Iowa']
    """
    # Get unique institutions (exclude aliases like USoCal)
    institutions = set(BIGTEN_COLORS_PRIMARY.keys())
    institutions.discard("USoCal")  # USC is the canonical name
    return sorted(institutions)

normalize_institution_name(name)

Normalize institution name to standard format.

This function handles various spellings, abbreviations, and nicknames for Big Ten institutions.

Args: name: Institution name (case-insensitive)

Returns: Normalized institution name

Raises: ValueError: If institution name is not recognized

Examples: >>> normalize_institution_name("msu") 'MSU' >>> normalize_institution_name("Spartans") 'MSU' >>> normalize_institution_name("buckeyes") 'Ohio State'

Source code in msuthemes/bigten.py
def normalize_institution_name(name: str) -> str:
    """Normalize institution name to standard format.

    This function handles various spellings, abbreviations, and nicknames
    for Big Ten institutions.

    Args:
        name: Institution name (case-insensitive)

    Returns:
        Normalized institution name

    Raises:
        ValueError: If institution name is not recognized

    Examples:
        >>> normalize_institution_name("msu")
        'MSU'
        >>> normalize_institution_name("Spartans")
        'MSU'
        >>> normalize_institution_name("buckeyes")
        'Ohio State'
    """
    # Convert to lowercase for lookup
    name_lower = name.strip().lower()

    # Check if already in canonical form
    if name in BIGTEN_COLORS_PRIMARY:
        return name

    # Check aliases
    if name_lower in INSTITUTION_ALIASES:
        return INSTITUTION_ALIASES[name_lower]

    # Not found
    available = list_bigten_institutions()
    raise ValueError(
        f"Institution '{name}' not recognized. "
        f"Available institutions: {', '.join(available)}"
    )

Constants

INSTITUTION_ALIASES = {'illinois': 'Illinois', 'uiuc': 'Illinois', 'fighting illini': 'Illinois', 'u of i': 'Illinois', 'indiana': 'Indiana', 'iu': 'Indiana', 'hoosiers': 'Indiana', 'iowa': 'Iowa', 'hawkeyes': 'Iowa', 'u of iowa': 'Iowa', 'maryland': 'Maryland', 'umd': 'Maryland', 'terps': 'Maryland', 'terrapins': 'Maryland', 'michigan': 'Michigan', 'um': 'Michigan', 'u-m': 'Michigan', 'umich': 'Michigan', 'wolverines': 'Michigan', 'msu': 'MSU', 'michigan state': 'MSU', 'spartans': 'MSU', 'state': 'MSU', 'minnesota': 'Minnesota', 'gophers': 'Minnesota', 'u of m': 'Minnesota', 'nebraska': 'Nebraska', 'huskers': 'Nebraska', 'cornhuskers': 'Nebraska', 'northwestern': 'Northwestern', 'nu': 'Northwestern', 'wildcats': 'Northwestern', 'ohio state': 'Ohio State', 'osu': 'Ohio State', 'buckeyes': 'Ohio State', 'the ohio state university': 'Ohio State', 'oregon': 'Oregon', 'ducks': 'Oregon', 'uo': 'Oregon', 'penn state': 'Penn State', 'psu': 'Penn State', 'nittany lions': 'Penn State', 'purdue': 'Purdue', 'boilermakers': 'Purdue', 'rutgers': 'Rutgers', 'scarlet knights': 'Rutgers', 'ru': 'Rutgers', 'ucla': 'UCLA', 'bruins': 'UCLA', 'usc': 'USC', 'usocal': 'USC', 'southern california': 'USC', 'trojans': 'USC', 'washington': 'Washington', 'uw': 'Washington', 'huskies': 'Washington', 'udub': 'Washington', 'wisconsin': 'Wisconsin', 'badgers': 'Wisconsin', 'uw-madison': 'Wisconsin'} module-attribute

Usage Examples

Getting Institution Colors

from msuthemes import get_bigten_colors

# Get colors for any institution
msu_colors = get_bigten_colors('Michigan State')
print(msu_colors)
# {'primary': '#18453b', 'secondary': '#ffffff'}

# Access individual colors
primary = msu_colors['primary']
secondary = msu_colors['secondary']

Creating Palettes

from msuthemes import bigten_palette

# Create palette for specific schools
schools = ['Michigan State', 'Michigan', 'Ohio State']
colors = bigten_palette(schools)

# Use in plot
import matplotlib.pyplot as plt
plt.bar(schools, [80, 75, 85], color=colors)
plt.show()

Using Primary and Secondary Colors

from msuthemes import bigten_palette

# Primary colors (default)
primary_colors = bigten_palette(['MSU', 'Michigan', 'Wisconsin'])

# Secondary colors
secondary_colors = bigten_palette(
    ['MSU', 'Michigan', 'Wisconsin'],
    color_type='secondary'
)

Name Flexibility

from msuthemes import get_bigten_colors

# All of these work:
get_bigten_colors('Michigan State')
get_bigten_colors('MSU')
get_bigten_colors('Spartans')
get_bigten_colors('michigan state')  # case-insensitive

Listing Institutions

from msuthemes import list_bigten_institutions

# Get all Big Ten institutions
institutions = list_bigten_institutions()
print(institutions)
# ['Illinois', 'Indiana', 'Iowa', ...]

Normalizing Institution Names

from msuthemes.bigten import normalize_institution_name

# Normalize various inputs
canonical = normalize_institution_name('MSU')
print(canonical)  # 'Michigan State'

canonical = normalize_institution_name('Spartans')
print(canonical)  # 'Michigan State'

canonical = normalize_institution_name('The Ohio State University')
print(canonical)  # 'Ohio State'

Complete Conference Visualization

from msuthemes import (
    bigten_palette,
    list_bigten_institutions,
    theme_msu
)
import matplotlib.pyplot as plt
import numpy as np

# Apply theme
theme_msu()

# Get all institutions and colors
institutions = list_bigten_institutions()
colors = bigten_palette(institutions)

# Create data
values = np.random.randint(60, 100, size=len(institutions))

# Plot
fig, ax = plt.subplots(figsize=(12, 8))
ax.barh(range(len(institutions)), values, color=colors)
ax.set_yticks(range(len(institutions)))
ax.set_yticklabels(institutions)
ax.set_xlabel('Value')
ax.set_title('Big Ten Conference Comparison')

plt.tight_layout()
plt.show()

Error Handling

from msuthemes import get_bigten_colors

try:
    colors = get_bigten_colors('Invalid School')
except ValueError as e:
    print(f"Error: {e}")
    # Handle invalid institution

Supported Institutions

All 18 Big Ten Conference institutions:

  • Illinois
  • Indiana
  • Iowa
  • Maryland
  • Michigan
  • Michigan State
  • Minnesota
  • Nebraska
  • Northwestern
  • Ohio State
  • Oregon
  • Penn State
  • Purdue
  • Rutgers
  • UCLA
  • USC
  • Washington
  • Wisconsin

Institution Aliases

Each institution supports multiple name variations. Examples:

Michigan State: - Michigan State - Michigan State University - MSU - Spartans - State

Ohio State: - Ohio State - The Ohio State University - OSU - Buckeyes

Northwestern: - Northwestern - Northwestern University - NU - Wildcats

See INSTITUTION_ALIASES constant for complete alias mapping.

See Also