Commit graph

19 commits

Author SHA1 Message Date
thehugwizard
593010b87b
Bugfix: HSL color ordering in ManimColor (#4202)
* Bugfix: colorsys uses HLS (hue, luminance, saturation) ordering when converting to/from rgb. Manim says it uses HSL ordering. Fixed order of parameters in call to colorsys for ManimColor.from_hsl and ManimColor.to_hsl.
Added tests ensure correct HSL ordering.

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

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

* Update to fix the correct color tests

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

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

---------

Co-authored-by: SonnyRoomex <sonny.campbell@roomex.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2025-04-21 01:46:59 +00:00
F. Muenkel
cd2a3b92f6
Fixed Tex environment doubling braces (#4159)
* Fix environment formating for Tex() mobject

* Add test for handling of Tex() environments
2025-02-09 11:56:59 -05:00
Benjamin Hackl
1efe869293
Completely rewrite Code mobject + add support for short notation RGB(A) hex code specifications to ManimColor (#4115)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-19 14:39:13 -03:00
Sophia Wisdom
86a971940f
Add __hash__ to ManimColor (#4051)
* add __hash__ to ManimColor

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

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

* Update core.py

* add test

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

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

* fix: correct typehint

* fix test

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-01-19 18:09:26 +01:00
Henrik Skov Midtiby
95b4625ef2
Fix of ImageMobject opacity bug (#4089)
* Fix issue 4072.

* Added a unittest for the interpolate function in utils/bezier.py
2025-01-19 16:56:47 +01:00
Hugo Chargois
fac0aa5218
Add darker, lighter and contrasting methods to ManimColor (#3992)
* Add darker, lighter and contrasting methods to ManimColor

* Fixes

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-11-25 11:05:08 +01:00
Aarush Deshpande
1097ed9692
Standardize docstrings with ruff pydocstyle rules (#3881)
Used Ruff rules for `pydocstyle` to standardize docstring formatting.

* Add config for ruff pydocstyle

* Safe fixes from ruff

* Unsafe fixes from ruff
2024-09-01 08:03:38 -04:00
Tristan Schulz
c47b2d5f44
Experimenting with an HSV class (#3518)
* 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 <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* 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 <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Add docstring to _internal_space

* naming of functions according to pep8

* Fix naming

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

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

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

---------

Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-25 22:44:22 +02:00
Abulafia
f1ce512225
Fixed behavior of config.background_opacity < 1 and duplicated log messages (#3680)
* Fixes #3614

Setting background_transparency=0.0 should have the same effect than
setting transparent=True. The output format must be compatible
with transparency (.mov, .webm). Otherwise ffpmeg fails.

This patch ensures that background_transparency=0.0 triggers the
change of the output format. Also a WARNING is raised about
the change in the output format.

I want to thank @SirJamesClarkMaxwell for inspiring me to tackle
this issue.

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

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

* test config.background_opacity < 1

* fix config behavior for config.background_opacity < 1

* fix logger messages being emitted twice

* actually cleanup usage of loggers, remove logger-imports; black

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

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

* dry_run fixture

* remove debug print

* applied suggestion from review

* remove custom fixture from test_deprecation, use manim_caplog

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

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

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-15 00:50:44 +02:00
Francisco Manríquez Novoa
1df1709e49
Rewrite manim.utils.bezier.get_quadratic_approximation_of_cubic() to produce curves which can be animated smoothly (#3829)
* Rewrite get_quadratic_approximation_of_cubic() and add test

* Move test_get... to end of file

* Complete docstring for get_quadratic...()
2024-07-13 18:27:45 +02:00
adeshpande
75625964b6
Change from tempconfig to a config fixture in tests (#3853)
* Implement changes to fixtures

* Change tests to use the config fixture
2024-07-12 22:41:51 +02:00
Francisco Manríquez Novoa
64ab9ade2b
Optimized manim.utils.bezier.get_smooth_cubic_bezier_handle_points() (#3767)
* Optimized manim.utils.get_smooth_cubic_bezier_handle_points()

* Fixed typo in docstring regarding vector u

* Add tests for get_smooth_cubic_bezier_handle_points

* Fix backreference in test docstrings

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

---------

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-06-26 16:33:39 +00:00
adeshpande
252aac30da
Add Ruff Lint (#3780)
Adds Ruff Linting to CI, and replaces isort in the pre-commit config with Ruff's isort rules.

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2024-06-03 23:39:08 -04:00
Francisco Manríquez Novoa
7b841c27cc
Created and optimized Bézier splitting functions such as partial_bezier_points() in manim.utils.bezier (#3766)
* Optimized manim.utils.partial_bezier_points()

* Added split_bezier, subdivide_bezier and bezier_remap, and tests

* Use bezier_remap() in VMobject and OpenGLVMobject()

* Note that partial_bezier_points is similar to calling split_bezier twice
2024-05-21 05:26:59 +00:00
pre-commit-ci[bot]
1aee37bfb5
[pre-commit.ci] pre-commit autoupdate (#3332)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.6.0)
- [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2)
- [github.com/asottile/pyupgrade: v3.10.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.15.2)
- [github.com/psf/black: 23.7.0 → 24.4.0](https://github.com/psf/black/compare/23.7.0...24.4.0)
- [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0)
- [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0)
- [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.1...v1.9.0)
- [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6)

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

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

* make smoothererstep readable again, avoid overlong line

* zoom_value more readable

* fix blacken-docs touching .github

* fix codespell setup, remove unnecessary file, fix some typos

* flake8: ignore E704, triggered by overload

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

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

* Update docs/source/tutorials/quickstart.rst

* more flake fixes

* try to make blacken-docs happy

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-04-24 13:11:03 +02:00
Viicos
68bd79093e
Refactor TexTemplate (#3520)
* Refactor `TexTemplate`

* Add tests, refactor some things

* Fixed Some tests

* Move typing imports

* Fix remaining tests

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

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

---------

Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-15 18:39:03 +00:00
Tristan Schulz
82e55b5da2
Adding :class: ManimColor to manim and converting all types (#3020)
* first draft of color class + starting library conversion

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

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

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

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

* changed everything to Manim color todo: figure out circular dependency in utils

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

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

* first working draft of new color version

* resolving conflicts

* resolving conflicts

* resolving conflicts

* resolving conflicts

* resolving conflicts

* changed default internal value of ManimColor to np.ndarray[float]

* starting to fix tests

* fixed more tests and changed precision of manim color

* removed premature color conversion

* fixed some more tests

* final test changes

* fix doctests

* fix for 3.8

* fixing ManimColor string representation

* removing some unneccesary conversions

* moved community constants to manim_colors.py and added more color standards

* broke some too long lines

* added fallback: check whether passed object has get_hex method

* actually fix _internal_from_string

* added hsv support

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

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

* remove dependency on colour

* fixed DARK_EARTH being assigned twice

* fixed double assignment

* remove more duplicated colour names

* raise NotImplementedError for ManimColor.gradient

* removed unused import

* remove superfluous ManimColor import

* fix circular import, remove dependency of space_ops on config

* one more Color -> ParseableManimColor

* removed one *-import

* somewhat unrelated fixed type hint

* -1 *-import

* fixed change of logic in CoordinateSystem.get_graph_label

* removed debug print; fixed type hint in mobject.py

* some fixes and improvements to text_mobject.py

* update three_dimensions

* fixes for rendered documentation of utils.color.*

* substantial improvements to documentation, including new Sphinx directive

Co-authored-by: MrDiver <mrdiverlp@gmail.com>

* Rewrite of the sphinx directive to use docutils nodes and 2 column design

* I just had to do it

* Improve the color table

* minor cleanup

* fixed ColorOverview example

* documentation improvements

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

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

* Update manim/mobject/mobject.py

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

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

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

* fix flake8 errors

* Removed test in test_text_mobject

* Improved Documentation of core.py and added private members in sphinx so that internal methods can be documented

* Change color types of labeled.py

* removed some unused imports

* turned docstring into comment

* _colors  -> _all_manim_colors; move to manim_color module

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

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

* fixed typing

* rewrite import

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Naveen M K <naveen521kk@gmail.com>
2023-08-08 14:47:00 +02:00
NotWearingPants
206db54af5
Migrate more os.path to pathlib in tests (#2991)
* Migrate more `os.path` to `pathlib` in tests

* Convert test fixtures to pathlib

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

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

* fix mypy errors in tests

* migrate another pathlib instance

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2022-10-26 19:51:38 +02:00
ad_chaos
677e88ef96
Refactor tests (#2866)
* start test reorganization

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

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

* move boolean ops

* move more tests

* Move more tests

* more reorganization

* more movements

* mostly finish up reorganization

* Finish reorganization tests in parent dir

* try moving interface tests back

* Move test_commands over

* fix relative path to templates

Co-authored-by: Darylgolden <darylgolden@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-09 21:10:30 +00:00