|
19 | 19 | # The following are type aliases. Once python 3.9 is dropped, they should be annotated |
20 | 20 | # using ``typing.TypeAlias`` and Unions should be converted to using ``|`` syntax. |
21 | 21 |
|
22 | | -ColorType = Union[tuple[float, float, float], tuple[float, float, float, float], str] |
| 22 | +RGBColorType = Union[tuple[float, float, float], tuple[float, float, float, float], str] |
| 23 | +RGBAColorType = Union[ |
| 24 | + str, # "none" or "#RRGGBBAA"/"#RGBA" hex strings |
| 25 | + tuple[float, float, float, float], |
| 26 | + # 2 tuple (color, alpha) representations, not infinitely recursive |
| 27 | + # RGBColorType includes the (str, float) tuple, even for RGBA strings |
| 28 | + tuple[RGBColorType, float], |
| 29 | + # (4-tuple, float) is odd, but accepted as the outer float overriding A of 4-tuple |
| 30 | + tuple[tuple[float, float, float, float], float] |
| 31 | +] |
| 32 | + |
| 33 | +ColorType = Union[RGBColorType, RGBAColorType] |
| 34 | + |
| 35 | +RGBColourType = RGBColorType |
| 36 | +RGBAColourType = RGBAColorType |
23 | 37 | ColourType = ColorType |
24 | 38 |
|
25 | 39 | LineStyleType = Union[str, tuple[float, Sequence[float]]] |
|
43 | 57 | ] |
44 | 58 |
|
45 | 59 | HashableList = list[Union[Hashable, "HashableList"]] |
| 60 | +"""A nested list of Hashable values.""" |
0 commit comments