Skip to content

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.

4 participants