Skip to content

Add Color module. #448

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

Merged
merged 1 commit into from
Apr 26, 2019
Merged

Add Color module. #448

merged 1 commit into from
Apr 26, 2019

Conversation

cknitt
Copy link
Member

@cknitt cknitt commented Apr 26, 2019

@MoOx As discussed on Discord:

  • This replaces Style.color with Color.t.
  • The latter is now not an abstract type anymore, but an alias to string.
  • This way people can just pass strings to color props like they can in JS.
  • This makes the API easier to use, but less safe.
  • For mitigation, we provide helper functions and constants for safe color creation/use in the Color module.

@cknitt cknitt requested review from MoOx and sgny April 26, 2019 16:45
Copy link
Member

@MoOx MoOx left a comment

Choose a reason for hiding this comment

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

This approach is so cool.

@cknitt cknitt merged commit 3360c24 into master Apr 26, 2019
@sgny
Copy link
Collaborator

sgny commented Apr 26, 2019

@cknitt Sure being able to pass strings has upside in ease and downside in less safety, on the other hand, now people will not make mistakes with named colors (cornflowerblue, etc.) if they use the constants and not simply pass their names as string.

And we could always move back to an abstract type, simply by adding a type-conversion function and defining an appropriate interface for the module. So overall, I agree this is a good move.

Great work and thanks for the huge effort.

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.

3 participants