peterhinch / micropython-nano-gui

A lightweight MicroPython GUI library for display drivers based on framebuf class
MIT License
508 stars 87 forks source link

Correct color names and hexadecimal codes #9

Open LDmicroGitHub opened 3 years ago

LDmicroGitHub commented 3 years ago

Hello, Peter. I propose to correct the color names and hex codes according to base colors from https://en.wikipedia.org/wiki/Web_colors

I think all hardware manufacturers are guided by these hex values. Also, some used color codes are unsafe if RGB565 or RGB444 converting used. 100=0x64 and 90=0x5A will lose the lowest bits when converting to RGB565 or RGB444.

I am not sure about the synonyms of colors. Probably they are not needed.

I haven't changed yet the else part of color definitions.

This pull request leads to some corrections in documentation and code due to the change in user colors.

Also, I propose to develop several color schemes similar to those used in editors with good contrast and readable. image

I want to know your opinion on the main. WIP

LDmicroGitHub commented 3 years ago

micropython-nano-gui\gui\demos\check_colors.py P10424-152111

peterhinch commented 3 years ago

My initial reaction is not one of enthusiasm. It will break users' applications and my test scripts. It will need to be tested on different displays: some drivers reduce the rgb() values to 8 or 12 bits. Some of my colors were chosen for specific results in my test scripts. There's a lot of work in checking all that...

I do take your point in the code comments about light and dark. I didn't choose my names wisely.

On the other hand I can see merit in standardising colors. Perhaps the best option is to produce a web_colors.py (or whatever name you think best) which can be renamed and swapped for my version. Then users have a choice.

IhorNehrutsa commented 3 years ago

Well. I understand your initial reaction. Backward compatibility is very important. Let's see what we can do.

I reverted the colors.py but left comments. 1) I propose to rename LIGHTRED as DARKRED with the accompanying comment There aren't LIGHTRED in other places of the repository.

2) DARKGREEN is present, so LIGHTGREEN rename to the SILVER = create_color(9, 0xC0, 0xC0, 0xC0) There are LIGHTGREEN in micropython-nano-gui\gui\demos\fpt.py micropython-nano-gui\FPLOT.md