CupertinoColors
CupertinoColors
#
with_opacity(opacity: int | float, color: ColorValue) -> str
#
Returns the color with the specified opacity.
PARAMETER | DESCRIPTION |
---|---|
opacity
|
The opacity value between |
color
|
The color to apply opacity to.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
A string representing the color with opacity, in the format |
Examples:
RAISES | DESCRIPTION |
---|---|
AssertionError
|
If the opacity is not between |
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:
|
weights
|
A dictionary mapping color members to their respective weights for weighted random selection.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
CupertinoColors | None
|
A randomly selected color, or None if all members are excluded. |
Examples: