Skip to content

Commit

Permalink
Experimenting with an HSV class (#3518)
Browse files Browse the repository at this point in the history
* Experimenting with an HSL class

* Add some more functionality

* Adding a lot of tests and implementing fully functional conversion between color spaces over proxy rgba

* Fixing tests

* Fixing typing

* return str to normal

* Additional documentation

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <[email protected]>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <[email protected]>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <[email protected]>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <[email protected]>

* Fix documentation and typing and revamp operators to respect color spaces

* Fix color operator typing and add operator tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix typeguard

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Import ManimFloat

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <[email protected]>

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <[email protected]>

* Add docstring to _internal_space

* naming of functions according to pep8

* Fix naming

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <[email protected]>

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Jason Grace <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 25, 2024
1 parent 2075f82 commit c47b2d5
Show file tree
Hide file tree
Showing 3 changed files with 578 additions and 50 deletions.
44 changes: 44 additions & 0 deletions manim/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
"RGBA_Tuple_Int",
"HSV_Array_Float",
"HSV_Tuple_Float",
"HSL_Array_Float",
"HSL_Tuple_Float",
"HSVA_Array_Float",
"HSVA_Tuple_Float",
"ManimColorInternal",
"PointDType",
"InternalPoint2D",
Expand Down Expand Up @@ -215,6 +219,46 @@
Brightness) in the represented color.
"""

HSVA_Array_Float: TypeAlias = RGBA_Array_Float
"""``shape: (4,)``
A :class:`numpy.ndarray` of 4 floats between 0 and 1, representing a
color in HSVA (or HSBA) format.
Its components describe, in order, the Hue, Saturation and Value (or
Brightness) in the represented color.
"""

HSVA_Tuple_Float: TypeAlias = RGBA_Tuple_Float
"""``shape: (4,)``
A tuple of 4 floats between 0 and 1, representing a color in HSVA (or
HSBA) format.
Its components describe, in order, the Hue, Saturation and Value (or
Brightness) in the represented color.
"""

HSL_Array_Float: TypeAlias = RGB_Array_Float
"""``shape: (3,)``
A :class:`numpy.ndarray` of 3 floats between 0 and 1, representing a
color in HSL format.
Its components describe, in order, the Hue, Saturation and Lightness
in the represented color.
"""

HSL_Tuple_Float: TypeAlias = RGB_Tuple_Float
"""``shape: (3,)``
A :class:`numpy.ndarray` of 3 floats between 0 and 1, representing a
color in HSL format.
Its components describe, in order, the Hue, Saturation and Lightness
in the represented color.
"""

ManimColorInternal: TypeAlias = RGBA_Array_Float
"""``shape: (4,)``
Expand Down
Loading

0 comments on commit c47b2d5

Please sign in to comment.