"""Color palette definitions for Portal."""

from __future__ import annotations

from portal.core.domain.models import WorktreeColor

# Default palette - carefully selected for visual distinction and accessibility
DEFAULT_COLORS = [
    WorktreeColor(
        name="Blue",
        hex="#0080FF",
        rgb=(0, 128, 255),
        hsl=(210, 100, 50),
        emoji="🔵",
        ansi_code="34",
        ansi_256=33,
        ansi_rgb="\033[38;2;0;128;255m",
        iterm_rgb="0.00 0.50 1.00",
        css_var="--portal-blue",
        contrast_ratio=3.1,
        is_dark=False,
    ),
    WorktreeColor(
        name="Green",
        hex="#00FF00",
        rgb=(0, 255, 0),
        hsl=(120, 100, 50),
        emoji="🟢",
        ansi_code="32",
        ansi_256=46,
        ansi_rgb="\033[38;2;0;255;0m",
        iterm_rgb="0.00 1.00 0.00",
        css_var="--portal-green",
        contrast_ratio=1.4,
        is_dark=False,
    ),
    WorktreeColor(
        name="Purple",
        hex="#AA00FF",
        rgb=(170, 0, 255),
        hsl=(280, 100, 50),
        emoji="🟣",
        ansi_code="35",
        ansi_256=128,
        ansi_rgb="\033[38;2;170;0;255m",
        iterm_rgb="0.67 0.00 1.00",
        css_var="--portal-purple",
        contrast_ratio=5.4,
        is_dark=True,
    ),
    WorktreeColor(
        name="Orange",
        hex="#FF8800",
        rgb=(255, 136, 0),
        hsl=(32, 100, 50),
        emoji="🟠",
        ansi_code="33",
        ansi_256=208,
        ansi_rgb="\033[38;2;255;136;0m",
        iterm_rgb="1.00 0.53 0.00",
        css_var="--portal-orange",
        contrast_ratio=2.3,
        is_dark=False,
    ),
    WorktreeColor(
        name="Red",
        hex="#FF0000",
        rgb=(255, 0, 0),
        hsl=(0, 100, 50),
        emoji="🔴",
        ansi_code="31",
        ansi_256=196,
        ansi_rgb="\033[38;2;255;0;0m",
        iterm_rgb="1.00 0.00 0.00",
        css_var="--portal-red",
        contrast_ratio=4.0,
        is_dark=False,
    ),
    WorktreeColor(
        name="Teal",
        hex="#00FFFF",
        rgb=(0, 255, 255),
        hsl=(180, 100, 50),
        emoji="🟦",
        ansi_code="36",
        ansi_256=51,
        ansi_rgb="\033[38;2;0;255;255m",
        iterm_rgb="0.00 1.00 1.00",
        css_var="--portal-teal",
        contrast_ratio=1.3,
        is_dark=False,
    ),
    WorktreeColor(
        name="Pink",
        hex="#FF0080",
        rgb=(255, 0, 128),
        hsl=(330, 100, 50),
        emoji="🩷",
        ansi_code="95",
        ansi_256=198,
        ansi_rgb="\033[38;2;255;0;128m",
        iterm_rgb="1.00 0.00 0.50",
        css_var="--portal-pink",
        contrast_ratio=3.5,
        is_dark=False,
    ),
    WorktreeColor(
        name="Indigo",
        hex="#4B0082",
        rgb=(75, 0, 130),
        hsl=(275, 100, 25),
        emoji="💜",  # Using purple heart as closest match
        ansi_code="94",
        ansi_256=54,
        ansi_rgb="\033[38;2;75;0;130m",
        iterm_rgb="0.29 0.00 0.51",
        css_var="--portal-indigo",
        contrast_ratio=12.0,
        is_dark=True,
    ),
    WorktreeColor(
        name="Amber",
        hex="#FFBF00",
        rgb=(255, 191, 0),
        hsl=(45, 100, 50),
        emoji="🟡",  # Yellow circle for amber
        ansi_code="93",
        ansi_256=214,
        ansi_rgb="\033[38;2;255;191;0m",
        iterm_rgb="1.00 0.75 0.00",
        css_var="--portal-amber",
        contrast_ratio=1.8,
        is_dark=False,
    ),
    WorktreeColor(
        name="Lime",
        hex="#80FF00",
        rgb=(128, 255, 0),
        hsl=(90, 100, 50),
        emoji="💚",  # Green heart for lime
        ansi_code="92",
        ansi_256=118,
        ansi_rgb="\033[38;2;128;255;0m",
        iterm_rgb="0.50 1.00 0.00",
        css_var="--portal-lime",
        contrast_ratio=1.2,
        is_dark=False,
    ),
    WorktreeColor(
        name="Light Blue",
        hex="#00BFFF",
        rgb=(0, 191, 255),
        hsl=(195, 100, 50),
        emoji="💙",  # Light blue heart as requested
        ansi_code="94",
        ansi_256=39,
        ansi_rgb="\033[38;2;0;191;255m",
        iterm_rgb="0.00 0.75 1.00",
        css_var="--portal-light-blue",
        contrast_ratio=2.0,
        is_dark=False,
    ),
    WorktreeColor(
        name="Cyan",
        hex="#00FFFF",
        rgb=(0, 255, 255),
        hsl=(180, 100, 50),
        emoji="🩵",  # Light blue square/heart for cyan
        ansi_code="96",
        ansi_256=51,
        ansi_rgb="\033[38;2;0;255;255m",
        iterm_rgb="0.00 1.00 1.00",
        css_var="--portal-cyan",
        contrast_ratio=1.3,
        is_dark=False,
    ),
    WorktreeColor(
        name="Brown",
        hex="#795548",
        rgb=(121, 85, 72),
        hsl=(16, 25, 38),
        emoji="🟤",  # Brown circle
        ansi_code="33",
        ansi_256=95,
        ansi_rgb="\033[38;2;121;85;72m",
        iterm_rgb="0.47 0.33 0.28",
        css_var="--portal-brown",
        contrast_ratio=7.8,
        is_dark=True,
    ),
    WorktreeColor(
        name="Blue Grey",
        hex="#607D8B",
        rgb=(96, 125, 139),
        hsl=(200, 18, 46),
        emoji="🩶",  # Grey heart
        ansi_code="37",
        ansi_256=66,
        ansi_rgb="\033[38;2;96;125;139m",
        iterm_rgb="0.38 0.49 0.55",
        css_var="--portal-blue-grey",
        contrast_ratio=5.5,
        is_dark=True,
    ),
    WorktreeColor(
        name="Yellow",
        hex="#FFFF00",
        rgb=(255, 255, 0),
        hsl=(60, 100, 50),
        emoji="🟡",
        ansi_code="93",
        ansi_256=226,
        ansi_rgb="\033[38;2;255;255;0m",
        iterm_rgb="1.00 1.00 0.00",
        css_var="--portal-yellow",
        contrast_ratio=1.1,
        is_dark=False,
    ),
    WorktreeColor(
        name="Deep Orange",
        hex="#FF4500",
        rgb=(255, 69, 0),
        hsl=(16, 100, 50),
        emoji="🧡",
        ansi_code="202",
        ansi_256=202,
        ansi_rgb="\033[38;2;255;69;0m",
        iterm_rgb="1.00 0.27 0.00",
        css_var="--portal-deep-orange",
        contrast_ratio=3.4,
        is_dark=False,
    ),
    WorktreeColor(
        name="Deep Purple",
        hex="#6600CC",
        rgb=(102, 0, 204),
        hsl=(270, 100, 40),
        emoji="💜",
        ansi_code="92",
        ansi_256=91,
        ansi_rgb="\033[38;2;102;0;204m",
        iterm_rgb="0.40 0.00 0.80",
        css_var="--portal-deep-purple",
        contrast_ratio=7.5,
        is_dark=True,
    ),
    WorktreeColor(
        name="Light Green",
        hex="#00FF7F",
        rgb=(0, 255, 127),
        hsl=(150, 100, 50),
        emoji="💚",
        ansi_code="119",
        ansi_256=48,
        ansi_rgb="\033[38;2;0;255;127m",
        iterm_rgb="0.00 1.00 0.50",
        css_var="--portal-light-green",
        contrast_ratio=1.3,
        is_dark=False,
    ),
    WorktreeColor(
        name="Violet",
        hex="#8B00FF",
        rgb=(139, 0, 255),
        hsl=(273, 100, 50),
        emoji="🟪",
        ansi_code="91",
        ansi_256=93,
        ansi_rgb="\033[38;2;139;0;255m",
        iterm_rgb="0.55 0.00 1.00",
        css_var="--portal-violet",
        contrast_ratio=6.2,
        is_dark=True,
    ),
    WorktreeColor(
        name="Coral",
        hex="#FF6B6B",
        rgb=(255, 107, 107),
        hsl=(0, 100, 71),
        emoji="🪸",
        ansi_code="209",
        ansi_256=203,
        ansi_rgb="\033[38;2;255;107;107m",
        iterm_rgb="1.00 0.42 0.42",
        css_var="--portal-coral",
        contrast_ratio=2.0,
        is_dark=False,
    ),
    WorktreeColor(
        name="Magenta",
        hex="#FF00FF",
        rgb=(255, 0, 255),
        hsl=(300, 100, 50),
        emoji="💜",
        ansi_code="161",
        ansi_256=201,
        ansi_rgb="\033[38;2;255;0;255m",
        iterm_rgb="1.00 0.00 1.00",
        css_var="--portal-magenta",
        contrast_ratio=3.1,
        is_dark=False,
    ),
    WorktreeColor(
        name="Sky Blue",
        hex="#00BFFF",
        rgb=(0, 191, 255),
        hsl=(195, 100, 50),
        emoji="🔷",
        ansi_code="45",
        ansi_256=39,
        ansi_rgb="\033[38;2;0;191;255m",
        iterm_rgb="0.00 0.75 1.00",
        css_var="--portal-sky-blue",
        contrast_ratio=2.0,
        is_dark=False,
    ),
    WorktreeColor(
        name="Gold",
        hex="#FFD700",
        rgb=(255, 215, 0),
        hsl=(51, 100, 50),
        emoji="🏆",
        ansi_code="220",
        ansi_256=220,
        ansi_rgb="\033[38;2;255;215;0m",
        iterm_rgb="1.00 0.84 0.00",
        css_var="--portal-gold",
        contrast_ratio=1.5,
        is_dark=False,
    ),
    WorktreeColor(
        name="Turquoise",
        hex="#40E0D0",
        rgb=(64, 224, 208),
        hsl=(174, 72, 56),
        emoji="🟦",
        ansi_code="30",
        ansi_256=80,
        ansi_rgb="\033[38;2;64;224;208m",
        iterm_rgb="0.25 0.88 0.82",
        css_var="--portal-turquoise",
        contrast_ratio=1.3,
        is_dark=False,
    ),
]


# High contrast palette for accessibility (WCAG AA compliance)
HIGH_CONTRAST_COLORS = [
    WorktreeColor(
        name="Navy",
        hex="#001F3F",
        rgb=(0, 31, 63),
        hsl=(210, 100, 12),
        ansi_code="34;1",
        ansi_256=17,
        ansi_rgb="\033[38;2;0;31;63m",
        iterm_rgb="0.00 0.12 0.25",
        css_var="--portal-navy",
        contrast_ratio=17.8,
        is_dark=True,
    ),
    WorktreeColor(
        name="Maroon",
        hex="#800000",
        rgb=(128, 0, 0),
        hsl=(0, 100, 25),
        ansi_code="31;1",
        ansi_256=88,
        ansi_rgb="\033[38;2;128;0;0m",
        iterm_rgb="0.50 0.00 0.00",
        css_var="--portal-maroon",
        contrast_ratio=11.2,
        is_dark=True,
    ),
    WorktreeColor(
        name="Forest Green",
        hex="#228B22",
        rgb=(34, 139, 34),
        hsl=(120, 61, 34),
        ansi_code="32;1",
        ansi_256=28,
        ansi_rgb="\033[38;2;34;139;34m",
        iterm_rgb="0.13 0.55 0.13",
        css_var="--portal-forest-green",
        contrast_ratio=5.4,
        is_dark=True,
    ),
    WorktreeColor(
        name="Dark Orange",
        hex="#FF8C00",
        rgb=(255, 140, 0),
        hsl=(33, 100, 50),
        ansi_code="33;1",
        ansi_256=208,
        ansi_rgb="\033[38;2;255;140;0m",
        iterm_rgb="1.00 0.55 0.00",
        css_var="--portal-dark-orange",
        contrast_ratio=2.3,
        is_dark=False,
    ),
    WorktreeColor(
        name="Midnight Blue",
        hex="#191970",
        rgb=(25, 25, 112),
        hsl=(240, 64, 27),
        ansi_code="34;1",
        ansi_256=18,
        ansi_rgb="\033[38;2;25;25;112m",
        iterm_rgb="0.10 0.10 0.44",
        css_var="--portal-midnight-blue",
        contrast_ratio=12.1,
        is_dark=True,
    ),
]
