Palette: Loading and Resolution#

Type Aliases#

irix.Palette.Hex = Hex#

Type alias.

Type aliases are created through the type statement:

type Alias = int

In this example, Alias and int will be treated equivalently by static type checkers.

At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.

Type aliases can also be generic:

type ListOrSet[T] = list[T] | set[T]

In this case, the type parameters of the alias are stored in the __type_params__ attribute.

See PEP 695 for more information.

irix.Palette.Hue = Hue#

Type alias.

Type aliases are created through the type statement:

type Alias = int

In this example, Alias and int will be treated equivalently by static type checkers.

At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.

Type aliases can also be generic:

type ListOrSet[T] = list[T] | set[T]

In this case, the type parameters of the alias are stored in the __type_params__ attribute.

See PEP 695 for more information.

irix.Palette.Shade = Shade#

Type alias.

Type aliases are created through the type statement:

type Alias = int

In this example, Alias and int will be treated equivalently by static type checkers.

At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.

Type aliases can also be generic:

type ListOrSet[T] = list[T] | set[T]

In this case, the type parameters of the alias are stored in the __type_params__ attribute.

See PEP 695 for more information.

irix.Palette.Swatch = Swatch#

Type alias.

Type aliases are created through the type statement:

type Alias = int

In this example, Alias and int will be treated equivalently by static type checkers.

At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.

Type aliases can also be generic:

type ListOrSet[T] = list[T] | set[T]

In this case, the type parameters of the alias are stored in the __type_params__ attribute.

See PEP 695 for more information.

irix.Palette.PaletteData = PaletteData#

Type alias.

Type aliases are created through the type statement:

type Alias = int

In this example, Alias and int will be treated equivalently by static type checkers.

At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.

Type aliases can also be generic:

type ListOrSet[T] = list[T] | set[T]

In this case, the type parameters of the alias are stored in the __type_params__ attribute.

See PEP 695 for more information.

class irix.Palette.Palette(*, data: PaletteData = {})#

An “architectonic” color palette instance, stored as YAML.

The palette maps hue names (e.g., 'slate', 'jade') to their twelve named shades (sheet1 … text2) and corresponding hex values for each pair. The Irix palettes carry twenty hues – five chambers of four hues each (see irix.Color.Color) – for 240 entries in total.

I Initial Methods#

classmethod Palette.dark() → Palette#

Return the built-in dark Irix palette.

classmethod Palette.light() → Palette#

Return the built-in light Irix palette.

classmethod Palette.full() → Palette#

Return the full dark palette: all Radix hues plus the three Irix originals.

This is the superset used by CLI tools (colorcode, promptcode) that need the whole hue range, not just the curated 20-hue Irix chamber subset. The Irix palette (dark()) is a strict subset of this palette.

classmethod Palette.full_light() → Palette#

Return the full light palette: all Radix hues plus the three Irix originals.

classmethod Palette.from_file(path: str | Path) → Palette#

Load a palette from an arbitrary YAML file.

Parameters:

path – Path to the YAML palette file.

II Public Methods#

property Palette.flat: dict[str, str]#

Return a flat mapping of '{hue}-{shade}' to hex values.

property Palette.hues: frozenset[str]#

Return the set of hue names in this palette.

Palette.resolve(color: str, shade: str = '') → str#

Resolve a color name or expression to a hex value.

Accepts, in priority order:

  1. A raw hex value starting with # — returned as-is.

  2. A fully-qualified color name like 'slate-sheet2'.

  3. A bare hue name combined with shade (e.g. 'slate' + 'sheet2').

Parameters:
  • color – The color expression to resolve.

  • shade – Optional shade name to append when color is a bare hue.

Returns:

The hex color string, or an empty string if not found.