b-pub / dwin-ico-tools

Tools to process DWIN LCD display 9.ICO files.
GNU General Public License v3.0
44 stars 13 forks source link

Font color? #3

Open kthornbloom opened 2 years ago

kthornbloom commented 2 years ago

Sorry to create an issue for what is actually just a question... but do you know how to change the font color? (for change between light/dark themes).

Also, huge thank you for this tool!

b-pub commented 2 years ago

You're welcome!

TLDR; use any image-editing tool you know to modify each image

The icon JPG files that are extracted are normal raster images (pixels). So, to change the font color, you'll use an image editing program to modify each one (photoshop, gimp, etc) by performing a color shift/hue change. That is no doubt tedious work, and also the only way. I don't recall if those programs still have a batch processing ability, but that would help.

The example color changes I provided are doing just this, but they take advantage of the particular color shifts caused by exchanging the R,G,B pixels around, and the library my code used allows you to swap the entire collection of R pixels in a simple statement. So if you have a full-red image (each pixel is ff,00,00 in R,G,B), this image could be converted to blue by exchanging the R and B channels. And similar for combinations: yellow (ff,ff,00) goes to cyan (00,ff,ff) by the same conversion; yellow (ff,ff,00) goes to magenta (ff,00,ff) by swapping G and B. This kind of editing is very limited, though.

A more complicated way to programmatically change colors (and what the image editing programs do with their hue changes I believe) is convert RGB to HSV, which allows for easy hue (H) changes with simple addition/subtraction. Then convert the HSV back to RGB to store. This allows you to make far more precise changes than gross swapping of R,G,B.

kthornbloom commented 2 years ago

Hey thank you for taking the time to respond! Sorry, I wasn't very specific in my question, I was wondering about the color of the actual text stuff (like the display of temperatures) which would be illegible if I was switching between dark/light backgrounds:

Screen Shot 2021-12-06 at 8 10 50 AM

Unless those are actually image glyphs somewhere 🤔

b-pub commented 2 years ago

Ahh. I don't know where text like that is stored. I know the 1_English and 2_Chinese jpg files contain string labels, but I don't recall where a raw alphabet or digits are stored. A read of the firmware may be needed for a hint, but I don't have the time right now.

If you look into this and figure it out, please post what you learn!