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