Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ColorIndex and basic implementations #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GeorgeMuscat
Copy link

@GeorgeMuscat GeorgeMuscat commented Mar 24, 2024

Added a public ColorIndex enum that has implementations for multiple traits to allow for easy conversions between colors and usize. The following are implemented:

  • From<ColorIndex> for Color
  • From<ColorIndex> for usize
  • TryFrom<usize> for ColorIndex
  • TryFrom<u64> for ColorIndex
  • TryFrom<Color> for ColorIndex

I believe this enum and the implementations are extremely useful for unsvg users as it maintains backwards compatibility while providing a self documenting interface that is easier to work with.

Please let me know if there is any issue :)

Resolves #6

@GeorgeMuscat GeorgeMuscat marked this pull request as draft March 25, 2024 14:19
@GeorgeMuscat GeorgeMuscat marked this pull request as ready for review March 25, 2024 14:19
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.

COLORS interface is unnecessarily difficult to work with.
1 participant