Colors
Colors
#
random(exclude: list[Colors] | None = None, weights: dict[Colors, int] | None = None) -> Colors | None
#
Selects a random color, with optional exclusions and weights.
PARAMETER | DESCRIPTION |
---|---|
exclude
|
A list of Colors to exclude from the selection. |
weights
|
A dictionary mapping color members to their respective weights for weighted random selection. |
RETURNS | DESCRIPTION |
---|---|
Colors | None
|
A randomly selected color, or None if all members are excluded. |
Examples:
with_opacity(opacity: int | float, color: ColorValue) -> str
#
Returns a color with the given 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 |