Skip to content

CupertinoColors

CupertinoColors #

Bases: str, Enum

with_opacity(opacity: int | float, color: ColorValue) -> str #

Returns the color with the specified opacity.

PARAMETER DESCRIPTION
opacity

The opacity value between 0.0 and 1.0.

TYPE: int | float

color

The color to apply opacity to.

TYPE: ColorValue

RETURNS DESCRIPTION
str

A string representing the color with opacity, in the format "color,opacity".

Examples:

>>> CupertinoColors.with_opacity(0.5, CupertinoColors.WHITE)
'white,0.5'
RAISES DESCRIPTION
AssertionError

If the opacity is not between 0 and 1 (inclusive).

random(exclude: list[CupertinoColors] | None = None, weights: dict[CupertinoColors, int] | None = None) -> CupertinoColors | None #

Selects a random color, with optional exclusions and weights.

PARAMETER DESCRIPTION
exclude

A list of colors members to exclude from the selection.

TYPE: list[CupertinoColors] | None DEFAULT: None

weights

A dictionary mapping color members to their respective weights for weighted random selection.

TYPE: dict[CupertinoColors, int] | None DEFAULT: None

RETURNS DESCRIPTION
CupertinoColors | None

A randomly selected color, or None if all members are excluded.

Examples:

>>> CupertinoColors.random(exclude=[CupertinoColors.WHITE])
CupertinoColors.ON_PRIMARY

ACTIVE_BLUE = 'activeBlue' #

ACTIVE_GREEN = 'activeGreen' #

ACTIVE_ORANGE = 'activeOrange' #

BLACK = 'cupertinoBlack' #

DARK_BACKGROUND_GRAY = 'darkBackgroundGray' #

DESTRUCTIVE_RED = 'destructiveRed' #

EXTRA_LIGHT_BACKGROUND_GRAY = 'extraLightBackgroundGray' #

INACTIVE_GRAY = 'inactiveGray' #

LABEL = 'label' #

LIGHT_BACKGROUND_GRAY = 'lightBackgroundGray' #

ON_PRIMARY = 'onprimary' #

OPAQUE_SEPARATOR = 'opaqueSeparator' #

PLACEHOLDER_TEXT = 'placeholderText' #

PRIMARY = 'primary' #

QUATERNARY_LABEL = 'quaternaryLabel' #

QUATERNARY_SYSTEM_FILL = 'quaternarySystemFill' #

SECONDARY_LABEL = 'secondaryLabel' #

SECONDARY_SYSTEM_BACKGROUND = 'secondarySystemBackground' #

SECONDARY_SYSTEM_FILL = 'secondarySystemFill' #

SECONDARY_SYSTEM_GROUPED_BACKGROUND = 'secondarySystemGroupedBackground' #

SEPARATOR = 'separator' #

SYSTEM_BACKGROUND = 'systemBackground' #

SYSTEM_BLUE = 'systemBlue' #

SYSTEM_BROWN = 'systemBrown' #

SYSTEM_CYAN = 'systemCyan' #

SYSTEM_FILL = 'systemFill' #

SYSTEM_GREEN = 'systemGreen' #

SYSTEM_GREY = 'systemGrey' #

SYSTEM_GREY2 = 'systemGrey2' #

SYSTEM_GREY3 = 'systemGrey3' #

SYSTEM_GREY4 = 'systemGrey4' #

SYSTEM_GREY5 = 'systemGrey5' #

SYSTEM_GREY6 = 'systemGrey6' #

SYSTEM_GROUPED_BACKGROUND = 'systemGroupedBackground' #

SYSTEM_INDIGO = 'systemIndigo' #

SYSTEM_MINT = 'systemMint' #

SYSTEM_ORANGE = 'systemOrange' #

SYSTEM_PINK = 'systemPink' #

SYSTEM_PURPLE = 'systemPurple' #

SYSTEM_RED = 'systemRed' #

SYSTEM_TEAL = 'systemTeal' #

SYSTEM_YELLOW = 'systemYellow' #

TERTIARY_LABEL = 'tertiaryLabel' #

TERTIARY_SYSTEM_BACKGROUND = 'tertiarySystemBackground' #

TERTIARY_SYSTEM_FILL = 'tertiarySystemFill' #

TERTIARY_SYSTEM_GROUPED_BACKGROUND = 'tertiarySystemGroupedBackground' #

WHITE = 'cupertinoWhite' #