vojtamolda / Plotly.swift

Interactive data visualization library for Swift
https://vojtamolda.github.io/Plotly.swift/
MIT License
82 stars 8 forks source link

Construct Color from predefined CSS constants #5

Closed vojtamolda closed 4 years ago

vojtamolda commented 4 years ago

Making a static member for each one of 140 HTML/CSS colors would prevent any potential for typos and allow nice code completion when one runs out imagination.

Color struct is currently implemented as an enum which makes it impossible to write an extension that would define a new one. Instead, it would be better to re-implement it as a struct with static members. This achieves the same level of user auto-completion convenience and much more extensible.

It would be also nice to add the full list with colored background to the documentation. XCode probably won't render it but Jazzy will and it makes the cross referencing much more enjoyable.

Here's a list a full list of supported HTML/CSS color names with their hex representations: https://www.w3schools.com/colors/colors_names.asp

![HTML Colors](https://user-images.githubusercontent.com/8467740/73982205-6d896980-48f9-11ea-8082-880669e707e1.png)
vojtamolda commented 4 years ago

Done!