|
31 | 31 | To implement a custom color space, you must subclass :class:`ManimColor` and implement
|
32 | 32 | three important methods:
|
33 | 33 |
|
34 |
| - - :attr:`~.ManimColor._internal_value`: a ``@property`` implemented on |
35 |
| - :class:`ManimColor` with the goal of keeping a consistent internal representation |
36 |
| - which can be referenced by other functions in :class:`ManimColor`. This property acts |
37 |
| - as a proxy to whatever representation you need in your class. |
| 34 | +- :attr:`~.ManimColor._internal_value`: a ``@property`` implemented on |
| 35 | + :class:`ManimColor` with the goal of keeping a consistent internal representation |
| 36 | + which can be referenced by other functions in :class:`ManimColor`. This property acts |
| 37 | + as a proxy to whatever representation you need in your class. |
38 | 38 |
|
39 |
| - - The getter should always return a NumPy array in the format ``[r,g,b,a]``, in |
40 |
| - accordance with the type :class:`ManimColorInternal`. |
| 39 | + - The getter should always return a NumPy array in the format ``[r,g,b,a]``, in |
| 40 | + accordance with the type :class:`ManimColorInternal`. |
41 | 41 |
|
42 |
| - - The setter should always accept a value in the format ``[r,g,b,a]`` which can be |
43 |
| - converted to whatever attributes you need. |
| 42 | + - The setter should always accept a value in the format ``[r,g,b,a]`` which can be |
| 43 | + converted to whatever attributes you need. |
44 | 44 |
|
45 |
| - - :attr:`~ManimColor._internal_space`: a read-only ``@property`` implemented on |
46 |
| - :class:`ManimColor` with the goal of providing a useful representation which can be |
47 |
| - used by operators, interpolation and color transform functions. |
| 45 | +- :attr:`~ManimColor._internal_space`: a read-only ``@property`` implemented on |
| 46 | + :class:`ManimColor` with the goal of providing a useful representation which can be |
| 47 | + used by operators, interpolation and color transform functions. |
48 | 48 |
|
49 |
| - The only constraints on this value are: |
| 49 | + The only constraints on this value are: |
50 | 50 |
|
51 |
| - - It must be a NumPy array. |
| 51 | + - It must be a NumPy array. |
52 | 52 |
|
53 |
| - - The last value must be the opacity in a range ``0.0`` to ``1.0``. |
| 53 | + - The last value must be the opacity in a range ``0.0`` to ``1.0``. |
54 | 54 |
|
55 |
| - Additionally, your ``__init__`` must support this format as an initialization value |
56 |
| - without additional parameters to ensure correct functionality of all other methods in |
57 |
| - :class:`ManimColor`. |
| 55 | + Additionally, your ``__init__`` must support this format as an initialization value |
| 56 | + without additional parameters to ensure correct functionality of all other methods in |
| 57 | + :class:`ManimColor`. |
| 58 | +
|
| 59 | +- :meth:`~ManimColor._from_internal`: a ``@classmethod`` which converts an |
| 60 | + ``[r,g,b,a]`` value into suitable parameters for your ``__init__`` method and calls |
| 61 | + the ``cls`` parameter. |
58 | 62 |
|
59 |
| - - :meth:`~ManimColor._from_internal`: a ``@classmethod`` which converts an |
60 |
| - ``[r,g,b,a]`` value into suitable parameters for your ``__init__`` method and calls |
61 |
| - the ``cls`` parameter. |
62 | 63 | """
|
63 | 64 |
|
64 | 65 | from __future__ import annotations
|
|
0 commit comments