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

simplify colors #60

Merged
merged 4 commits into from
Mar 7, 2025
Merged

simplify colors #60

merged 4 commits into from
Mar 7, 2025

Conversation

thomcsmits
Copy link
Collaborator

@thomcsmits thomcsmits commented Mar 6, 2025

this PR adds a prop simplifyColor. When set to true, it will take an approximate color name (from a default list, calculated in RBG space) rather than the most exact with the hex-color-to-color-name package

@thomcsmits thomcsmits requested a review from sehilyi March 6, 2025 16:58
@thomcsmits
Copy link
Collaborator Author

@sehilyi right now a prop. Thoughts on:

  1. making this the default?
  2. removing the option for hex-to-color-name altogether?

Copy link
Member

@sehilyi sehilyi left a comment

Choose a reason for hiding this comment

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

I really like the change you made!

I think the simplified color names are more usable than the previous ones. More understandable and more transparent in terms of how color names are defined. I think it makes sense to at least make these the default color names. I think we can even remove the previous ones.

If we want a user to define their own color names, we can expose a corresponding function:

import { GetColorName } from 'color-hex-to-color-name';
// ...
<AltGoslingComponent
  spec={spec}
  // user can define their own color names
  customColorNames={(hex: string) => GetColorName(hex)}
/>

@thomcsmits
Copy link
Collaborator Author

@sehilyi great suggestion! merging this right now so we can use it in geranium, but I parked the customColorNames in this issue #63 to work on this in the near future

@thomcsmits thomcsmits merged commit 389414a into master Mar 7, 2025
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.

2 participants