FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add Color module. by cknitt · Pull Request #448 · rescript-react-native/rescript-react-native · GitHub

Add Color module. - #448

Merged
cknitt merged 1 commit into
masterfrom
color
Apr 26, 2019
Merged

Add Color module.#448
cknitt merged 1 commit into
masterfrom
color

Conversation

cknitt commented Apr 26, 2019

Copy link
Copy Markdown
Member

@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 requested review from MoOx and sgny April 26, 2019 16:45

MoOx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This approach is so cool.

cknitt merged commit 3360c24 into master Apr 26, 2019

sgny commented Apr 26, 2019
edited
Loading

Copy link
Copy Markdown
Collaborator

@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.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL