Skip to content

Conversation

@ludwigjo
Copy link

@ludwigjo ludwigjo commented Mar 9, 2022

Overview: What does this pull request change?

This PR improves the color handling by removing uses of the Colors class and replace usage of the Enums with color constants as specified in #2451 . At this point, a deprecation warning is raised when trying to use the Colors class using manim.utils.deprecation.

Some of the functions previously defined in color.py that has existing functionality in the colour module has also been replaced.

For instance:
rgb_to_hex() has been replaced by rgb2hex().

Motivation and Explanation: Why and how do your changes improve the library?

The overall goal is to simplify the use of color by standardizing the approach as stated in #2451 . By deprecating the use of the Enums and providing a way of using the constants in a similar way, we're creating a standard for how colors should be used.

Links to added or changed documentation pages

Further Information and Comments

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

ludwigjo and others added 10 commits March 7, 2022 11:42
…o… (#6)

* Removed enum from color class and temporar fix to access constant from text_mobjects, fix #2

* Removed color class and improved safety on how constant are accessed, fix #2
* Converts values in setting_args dict in _get_settings_from_t2xs to string to make sure that all values are of type string.

* Makes color constants instances of Color-class from colour-module and updates color_gradient to handle gradient with one color, fixes #7.
* Added deprecation warnings for color conversions, feat #1

* Update and remove unecessary warnings, fix #1

* Added more specific deprecation warnings

* Removed warnings from functions that are not in `colour` module

* Fixed deprecation warning in `color_to_rgb`, fix #1
* Added deprecation warnings when accessing color enums, fix #8

* Simplified import statement for warnings, fix #8
* Removed `color_to_rgb` from `vector_field.py`, feat #4

* Removed usage of `color_to_rgb` from `color.py`, feat #4

* Removed usage of `color_to_rgb` from `opengl_mobject.py`, feat #4

* Fixed `probability.py` to use `Color` instead of `str`, fix #4

* Remove usage of `rgb_to_hex` from `opengl_mobject.py`, feat #4

* Removed usage of `rgb_to_hex` from `opengl_vectorized_mobject.py`, feat #4

* Remove usage of `rgb_to_hex` in `style_utils.py`, fix #4
* Changed `warnings` to `@deprecated` in `color.py`, feat #14

* Removed `deprecated` from functions used internally, fix #14
@Darylgolden
Copy link
Member

Looks like these changes broke some part of BarChart, as can be seen from the docbuild. Can you fix it?

@Darylgolden Darylgolden marked this pull request as draft March 21, 2022 07:25
@Darylgolden
Copy link
Member

I've converted this into a draft for now. Feel free to unconvert once the docbuild passes, and let us know if you need any help.

@Darylgolden
Copy link
Member

Hello, are you planning to continue working on this?

@MrDiver
Copy link
Collaborator

MrDiver commented Jun 18, 2022

I think i will go about my way doing this in a few days

@MrDiver MrDiver closed this Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Rejected

Development

Successfully merging this pull request may close these issues.

5 participants