ChenYilong / ChenYilong/iOS11AdaptationTips
How can we use Assets Catalog Colors Sets?
- Dominant language
- No language data
- Stars
- 477
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
_(short answer to the question update: no, there is no `UIColor(named: "color-name")` or similar in Xcode 9.0 beta)_
Answering the original question:
1. you create your color set
[![enter image description here][1]][1]
2. you find your color among your snippets and you drag-n-drop it
[![enter image description here][2]][2]
3. it will translate to a color literal when looking at the source code:
`#colorLiteral(red: 0, green: 0.6378085017, blue: 0.8846047521, alpha: 1)`
You notice how the values of red, green and blue are different? It's because I defined them using Color Space `Display P3`, but the colorLiteral is using Color Space `sRGB`.
[1]: https://i.stack.imgur.com/Rzb48.png
[2]: https://i.stack.imgur.com/wGnf5.png
Reference: [How can we use Assets Catalog Colors Sets?](https://stackoverflow.com/questions/44397680/how-can-we-use-assets-catalog-colors-sets)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.