manosim / ui-color

Converting HEX & RGB colors to UIColor for both Objective C & Swift.
https://www.uicolor.io/
MIT License
226 stars 39 forks source link

Increased precision #40

Open alphapeter opened 3 years ago

alphapeter commented 3 years ago

Hi! First off, thanks for your excellent work of providing this tool. It was one of the first hits when searching using google. The UI looks nice too.

I found that using just two digits for the decimal part will loose precision during conversion. RGB is 256 levels (0-255) and two digit precision will only allow 100 levels (00-99), loosing about half of the precision. Picky QA will notice this when using color picker tool.

I don't know if you still maintain this page or not, but a simple solution would be either to just increase precision to 3 digits or allow for changing the precision in the UI. I tested the latter approach, providing an additional input field for setting the precision. I made a simple deploy using github pages at https://ui-color.klaesson.net if you want to try it out. I defaulted to 4 digits (but can be set to whatever, 3 will probably be sufficient). I could probably create a PR too if you want.