-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Expand file tree
/
Copy pathcolors.pyi
More file actions
449 lines (418 loc) · 14.6 KB
/
colors.pyi
File metadata and controls
449 lines (418 loc) · 14.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from matplotlib import cbook, scale
import re
from typing import Any, Literal, overload
from .typing import ColorType
import numpy as np
from numpy.typing import ArrayLike
# Explicitly export colors dictionaries which are imported in the impl
BASE_COLORS: dict[str, ColorType]
CSS4_COLORS: dict[str, ColorType]
TABLEAU_COLORS: dict[str, ColorType]
XKCD_COLORS: dict[str, ColorType]
class _ColorMapping(dict[str, ColorType]):
cache: dict[tuple[ColorType, float | None], tuple[float, float, float, float]]
def __init__(self, mapping) -> None: ...
def __setitem__(self, key, value) -> None: ...
def __delitem__(self, key) -> None: ...
def get_named_colors_mapping() -> _ColorMapping: ...
class ColorSequenceRegistry(Mapping):
def __init__(self) -> None: ...
def __getitem__(self, item: str) -> list[ColorType]: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
def register(self, name: str, color_list: Iterable[ColorType]) -> None: ...
def unregister(self, name: str) -> None: ...
_color_sequences: ColorSequenceRegistry = ...
def is_color_like(c: Any) -> bool: ...
def same_color(c1: ColorType, c2: ColorType) -> bool: ...
def to_rgba(
c: ColorType, alpha: float | None = ...
) -> tuple[float, float, float, float]: ...
def to_rgba_array(
c: ColorType | ArrayLike, alpha: float | ArrayLike | None = ...
) -> np.ndarray: ...
def to_rgb(c: ColorType) -> tuple[float, float, float]: ...
def to_hex(c: ColorType, keep_alpha: bool = ...) -> str: ...
cnames: dict[str, ColorType]
hexColorPattern: re.Pattern
rgb2hex = to_hex
hex2color = to_rgb
class ColorConverter:
colors: _ColorMapping
cache: dict[tuple[ColorType, float | None], tuple[float, float, float, float]]
@staticmethod
def to_rgb(c: ColorType) -> tuple[float, float, float]: ...
@staticmethod
def to_rgba(
c: ColorType, alpha: float | None = ...
) -> tuple[float, float, float, float]: ...
@staticmethod
def to_rgba_array(
c: ColorType | ArrayLike, alpha: float | ArrayLike | None = ...
) -> np.ndarray: ...
colorConverter: ColorConverter
class Colormap:
name: str
N: int
colorbar_extend: bool
def __init__(self, name: str, N: int = ...) -> None: ...
@overload
def __call__(
self, X: Sequence[float] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ...
) -> np.ndarray: ...
@overload
def __call__(
self, X: float, alpha: float | None = ..., bytes: bool = ...
) -> tuple[float, float, float, float]: ...
@overload
def __call__(
self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ...
) -> tuple[float, float, float, float] | np.ndarray: ...
def __copy__(self) -> Colormap: ...
def __eq__(self, other: object) -> bool: ...
def get_bad(self) -> np.ndarray: ...
def set_bad(self, color: ColorType = ..., alpha: float | None = ...) -> None: ...
def get_under(self) -> np.ndarray: ...
def set_under(self, color: ColorType = ..., alpha: float | None = ...) -> None: ...
def get_over(self) -> np.ndarray: ...
def set_over(self, color: ColorType = ..., alpha: float | None = ...) -> None: ...
def set_extremes(
self,
*,
bad: ColorType | None = ...,
under: ColorType | None = ...,
over: ColorType | None = ...
) -> None: ...
def with_extremes(
self,
*,
bad: ColorType | None = ...,
under: ColorType | None = ...,
over: ColorType | None = ...
) -> Colormap: ...
def is_gray(self) -> bool: ...
def resampled(self, lutsize: int) -> Colormap: ...
def reversed(self, name: str | None = ...) -> Colormap: ...
def _repr_html_(self) -> str: ...
def _repr_png_(self) -> bytes: ...
def copy(self) -> Colormap: ...
class LinearSegmentedColormap(Colormap):
monochrome: bool
def __init__(
self,
name: str,
segmentdata: dict[
Literal["red", "green", "blue", "alpha"], Sequence[tuple[float, ...]]
],
N: int = ...,
gamma: float = ...,
) -> None: ...
def set_gamma(self, gamma: float) -> None: ...
@staticmethod
def from_list(
name: str, colors: ArrayLike | Sequence[tuple[float, ColorType]], N: int = ..., gamma: float = ...
) -> LinearSegmentedColormap: ...
def resampled(self, lutsize: int) -> LinearSegmentedColormap: ...
def reversed(self, name: str | None = ...) -> LinearSegmentedColormap: ...
class ListedColormap(Colormap):
monochrome: bool
colors: ArrayLike | ColorType
def __init__(
self, colors: ArrayLike | ColorType, name: str = ..., N: int | None = ...
) -> None: ...
def resampled(self, lutsize: int) -> ListedColormap: ...
def reversed(self, name: str | None = ...) -> ListedColormap: ...
class MultivarColormap:
name: str
n_variates: int
def __init__(self, colormaps: list[Colormap], combination_mode: Literal['sRGB_add', 'sRGB_sub'], name: str = ...) -> None: ...
@overload
def __call__(
self, X: Sequence[Sequence[float]] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ..., clip: bool = ...
) -> np.ndarray: ...
@overload
def __call__(
self, X: Sequence[float], alpha: float | None = ..., bytes: bool = ..., clip: bool = ...
) -> tuple[float, float, float, float]: ...
@overload
def __call__(
self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ..., clip: bool = ...
) -> tuple[float, float, float, float] | np.ndarray: ...
def copy(self) -> MultivarColormap: ...
def __copy__(self) -> MultivarColormap: ...
def __eq__(self, other: Any) -> bool: ...
def __getitem__(self, item: int) -> Colormap: ...
def __iter__(self) -> Iterator[Colormap]: ...
def __len__(self) -> int: ...
def get_bad(self) -> np.ndarray: ...
def resampled(self, lutshape: Sequence[int | None]) -> MultivarColormap: ...
def with_extremes(
self,
*,
bad: ColorType | None = ...,
under: Sequence[ColorType] | None = ...,
over: Sequence[ColorType] | None = ...
) -> MultivarColormap: ...
@property
def combination_mode(self) -> str: ...
def _repr_html_(self) -> str: ...
def _repr_png_(self) -> bytes: ...
class BivarColormap:
name: str
N: int
M: int
n_variates: int
def __init__(
self, N: int = ..., M: int | None = ..., shape: Literal['square', 'circle', 'ignore', 'circleignore'] = ...,
origin: Sequence[float] = ..., name: str = ...
) -> None: ...
@overload
def __call__(
self, X: Sequence[Sequence[float]] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ...
) -> np.ndarray: ...
@overload
def __call__(
self, X: Sequence[float], alpha: float | None = ..., bytes: bool = ...
) -> tuple[float, float, float, float]: ...
@overload
def __call__(
self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ...
) -> tuple[float, float, float, float] | np.ndarray: ...
@property
def lut(self) -> np.ndarray: ...
@property
def shape(self) -> str: ...
@property
def origin(self) -> tuple[float, float]: ...
def copy(self) -> BivarColormap: ...
def __copy__(self) -> BivarColormap: ...
def __getitem__(self, item: int) -> Colormap: ...
def __eq__(self, other: Any) -> bool: ...
def get_bad(self) -> np.ndarray: ...
def get_outside(self) -> np.ndarray: ...
def resampled(self, lutshape: Sequence[int | None], transposed: bool = ...) -> BivarColormap: ...
def transposed(self) -> BivarColormap: ...
def reversed(self, axis_0: bool = ..., axis_1: bool = ...) -> BivarColormap: ...
def with_extremes(
self,
*,
bad: ColorType | None = ...,
outside: ColorType | None = ...,
shape: str | None = ...,
origin: None | Sequence[float] = ...,
) -> MultivarColormap: ...
def _repr_html_(self) -> str: ...
def _repr_png_(self) -> bytes: ...
class SegmentedBivarColormap(BivarColormap):
def __init__(
self, patch: np.ndarray, N: int = ..., shape: Literal['square', 'circle', 'ignore', 'circleignore'] = ...,
origin: Sequence[float] = ..., name: str = ...
) -> None: ...
class BivarColormapFromImage(BivarColormap):
def __init__(
self, lut: np.ndarray, shape: Literal['square', 'circle', 'ignore', 'circleignore'] = ...,
origin: Sequence[float] = ..., name: str = ...
) -> None: ...
class Normalize:
callbacks: cbook.CallbackRegistry
def __init__(
self, vmin: float | None = ..., vmax: float | None = ..., clip: bool = ...
) -> None: ...
@property
def vmin(self) -> float | None: ...
@vmin.setter
def vmin(self, value: float | None) -> None: ...
@property
def vmax(self) -> float | None: ...
@vmax.setter
def vmax(self, value: float | None) -> None: ...
@property
def clip(self) -> bool: ...
@clip.setter
def clip(self, value: bool) -> None: ...
@staticmethod
def process_value(value: ArrayLike) -> tuple[np.ma.MaskedArray, bool]: ...
@overload
def __call__(self, value: float, clip: bool | None = ...) -> float: ...
@overload
def __call__(self, value: np.ndarray, clip: bool | None = ...) -> np.ma.MaskedArray: ...
@overload
def __call__(self, value: ArrayLike, clip: bool | None = ...) -> ArrayLike: ...
@overload
def inverse(self, value: float) -> float: ...
@overload
def inverse(self, value: np.ndarray) -> np.ma.MaskedArray: ...
@overload
def inverse(self, value: ArrayLike) -> ArrayLike: ...
def autoscale(self, A: ArrayLike) -> None: ...
def autoscale_None(self, A: ArrayLike) -> None: ...
def scaled(self) -> bool: ...
class TwoSlopeNorm(Normalize):
def __init__(
self, vcenter: float, vmin: float | None = ..., vmax: float | None = ...
) -> None: ...
@property
def vcenter(self) -> float: ...
@vcenter.setter
def vcenter(self, value: float) -> None: ...
def autoscale_None(self, A: ArrayLike) -> None: ...
class CenteredNorm(Normalize):
def __init__(
self, vcenter: float = ..., halfrange: float | None = ..., clip: bool = ...
) -> None: ...
@property
def vcenter(self) -> float: ...
@vcenter.setter
def vcenter(self, vcenter: float) -> None: ...
@property
def halfrange(self) -> float: ...
@halfrange.setter
def halfrange(self, halfrange: float) -> None: ...
@overload
def make_norm_from_scale(
scale_cls: type[scale.ScaleBase],
base_norm_cls: type[Normalize],
*,
init: Callable | None = ...
) -> type[Normalize]: ...
@overload
def make_norm_from_scale(
scale_cls: type[scale.ScaleBase],
base_norm_cls: None = ...,
*,
init: Callable | None = ...
) -> Callable[[type[Normalize]], type[Normalize]]: ...
class FuncNorm(Normalize):
def __init__(
self,
functions: tuple[Callable, Callable],
vmin: float | None = ...,
vmax: float | None = ...,
clip: bool = ...,
) -> None: ...
class LogNorm(Normalize): ...
class SymLogNorm(Normalize):
def __init__(
self,
linthresh: float,
linscale: float = ...,
vmin: float | None = ...,
vmax: float | None = ...,
clip: bool = ...,
*,
base: float = ...,
) -> None: ...
@property
def linthresh(self) -> float: ...
@linthresh.setter
def linthresh(self, value: float) -> None: ...
class AsinhNorm(Normalize):
def __init__(
self,
linear_width: float = ...,
vmin: float | None = ...,
vmax: float | None = ...,
clip: bool = ...,
) -> None: ...
@property
def linear_width(self) -> float: ...
@linear_width.setter
def linear_width(self, value: float) -> None: ...
class PowerNorm(Normalize):
gamma: float
def __init__(
self,
gamma: float,
vmin: float | None = ...,
vmax: float | None = ...,
clip: bool = ...,
) -> None: ...
class BoundaryNorm(Normalize):
boundaries: np.ndarray
N: int
Ncmap: int
extend: Literal["neither", "both", "min", "max"]
def __init__(
self,
boundaries: ArrayLike,
ncolors: int,
clip: bool = ...,
*,
extend: Literal["neither", "both", "min", "max"] = ...
) -> None: ...
class NoNorm(Normalize): ...
def rgb_to_hsv(arr: ArrayLike) -> np.ndarray: ...
def hsv_to_rgb(hsv: ArrayLike) -> np.ndarray: ...
class LightSource:
azdeg: float
altdeg: float
hsv_min_val: float
hsv_max_val: float
hsv_min_sat: float
hsv_max_sat: float
def __init__(
self,
azdeg: float = ...,
altdeg: float = ...,
hsv_min_val: float = ...,
hsv_max_val: float = ...,
hsv_min_sat: float = ...,
hsv_max_sat: float = ...,
) -> None: ...
@property
def direction(self) -> np.ndarray: ...
def hillshade(
self,
elevation: ArrayLike,
vert_exag: float = ...,
dx: float = ...,
dy: float = ...,
fraction: float = ...,
) -> np.ndarray: ...
def shade_normals(
self, normals: np.ndarray, fraction: float = ...
) -> np.ndarray: ...
def shade(
self,
data: ArrayLike,
cmap: Colormap,
norm: Normalize | None = ...,
blend_mode: Literal["hsv", "overlay", "soft"] | Callable = ...,
vmin: float | None = ...,
vmax: float | None = ...,
vert_exag: float = ...,
dx: float = ...,
dy: float = ...,
fraction: float = ...,
**kwargs
) -> np.ndarray: ...
def shade_rgb(
self,
rgb: ArrayLike,
elevation: ArrayLike,
fraction: float = ...,
blend_mode: Literal["hsv", "overlay", "soft"] | Callable = ...,
vert_exag: float = ...,
dx: float = ...,
dy: float = ...,
**kwargs
) -> np.ndarray: ...
def blend_hsv(
self,
rgb: ArrayLike,
intensity: ArrayLike,
hsv_max_sat: float | None = ...,
hsv_max_val: float | None = ...,
hsv_min_val: float | None = ...,
hsv_min_sat: float | None = ...,
) -> ArrayLike: ...
def blend_soft_light(
self, rgb: np.ndarray, intensity: np.ndarray
) -> np.ndarray: ...
def blend_overlay(self, rgb: np.ndarray, intensity: np.ndarray) -> np.ndarray: ...
def from_levels_and_colors(
levels: Sequence[float],
colors: Sequence[ColorType],
extend: Literal["neither", "min", "max", "both"] = ...,
) -> tuple[ListedColormap, BoundaryNorm]: ...