Skip to content

Conversation

@ludwigjo
Copy link

@ludwigjo ludwigjo commented Mar 4, 2022

Removed the enums from color.py and made changes to files still using the enums instead of constants.

Closes: #2 #3

Copy link

@amandakrohn amandakrohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment.

else:
return Colors[col.lower()].value
testCol = col.upper()
return globals()[testCol]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if using globals() is good practice? We should instead store all the colors in some data structure and use that one. As suggested by @Darylgolden:

Regarding the first point: I've realized that random_color relies on an object containing information on all preset colors, so perhaps it might not be desirable to remove such an object entirely. Perhaps Colors should be a list? I'm not sure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I've changed how the values can be accessed now

Copy link

@BrorSebastianSjovald BrorSebastianSjovald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. All tests that pass before, pass this version as well.

@BrorSebastianSjovald BrorSebastianSjovald merged commit e96329c into refactor/color Mar 7, 2022
BrorSebastianSjovald pushed a commit that referenced this pull request Mar 9, 2022
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants