from typing import Self

from . import Color
from .style import AnsiColor, Layer


class ThemeEntry_DefaultForeground(ThemeEntry):
    """A theme entry for one of the default colors."""
    def __new__(cls) -> Self: ...


class ThemeEntry_DefaultBackground(ThemeEntry):
    """A theme entry for one of the default colors."""
    def __new__(cls) -> Self: ...


class ThemeEntry_Ansi(ThemeEntry):
    """A theme entry for one of the ANSI colors."""
    def __new__(cls, color: AnsiColor) -> Self: ...


class ThemeEntry:
    """The 18 colors in a theme."""
    DefaultForeground = ThemeEntry_DefaultForeground
    DefaultBackground = ThemeEntry_DefaultBackground
    Ansi = ThemeEntry_Ansi

    @staticmethod
    def all() -> ThemeEntryIterator: ...
    @staticmethod
    def try_from_index(index: int) -> ThemeEntry: ...
    def name(self) -> str: ...
    def abbr(self) -> str: ...
    def parse(self, s: bytes) -> Color: ...
    def __hash__(self) -> int: ...
    def __eq__(self, other: object) -> bool: ...
    def __ne__(self, other: object) -> bool: ...
    def __gt__(self, other: object) -> bool: ...
    def __ge__(self, other: object) -> bool: ...
    def __lt__(self, other: object) -> bool: ...
    def __le__(self, other: object) -> bool: ...
    def __repr__(self) -> str: ...
    def __str__(self) -> str: ...


class ThemeEntryIterator:
    """An iterator over all theme entries."""
    def __len__(self) -> int: ...
    def __iter__(self) -> Self: ...
    def __next__(self) -> ThemeEntry: ...


class Theme:
    """A color theme."""
    @staticmethod
    def query_terminal() -> Theme: ...

    def __new__(cls, colors: list[Color]) -> Self: ...
    def __getitem__(self, index: ThemeEntry|AnsiColor|Layer) -> Color: ...
    def __setitem__(self, index: ThemeEntry|AnsiColor|Layer, color: Color) -> Color: ...
    def __repr__(self) -> str: ...


VGA_COLORS: Theme =  ...
