How do I change tags properties with SuperTool? When I switch from dark to light theme and vice versa, I would like to invert (complement actually) the color of the tags so that the whites become black and vice versa. How do I do this with SuperTool?
Here for example are my tags when I am in light and dark theme:
You want to walk through all the tags and change all their 48-bit #rrrrggggbbbb color string values to the complementary for dark mode. And running again restore the original colors. Right?
Which question are you asking ?
the math of changing a color to its complementary Dark mode color
Changing Tag object attributes (How to access the list of Tags, getting the color, setting the color?)
Perplexity AI overview of color convert process … without any policy‐violating example code. (The brightness downscaling means some rounding errors creep in … even if a brightness upscaling for Light mode conversions is added.):
To determine a dark mode variant of a light mode color in the 48-bit format "#rrrrggggbbbb", you can adjust the brightness or invert the color while preserving its format.
Specifically:
Input Validation: Ensure the input is in "#rrrrggggbbbb" format.
Extract Components: Parse the red, green, and blue components as 16-bit integers.
Invert and Adjust Brightness:
Invert each component by subtracting it from 0xFFFF.
Scale down brightness using a factor (e.g., 0.8) for better contrast.
Clamp Values: Ensure RGB values remain within the valid range (0–65535).
Output Format: Return the adjusted color in "#rrrrggggbbbb" format.
This approach ensures compatibility with 48-bit colors while producing visually distinct dark mode variants.
As I can see in Gramps Developer docs on Tags, color format is #rrrrggggbbbb. What kind of format is that? I know RGB format in hexadecimal notation (6 hexadecimal characters - i.e. ffbb00) but what is this one? Octal?
#ffbb00 is an example of 24-bit color RGB format as a string value: three 8-bit hexadecimal values allowing 0-255 for each of the Red, Green, and Blue channels.
#ffffbbbb0000 is an example 48-bit color RGB format a string value: three 16-bit hexadecimal values allowing 0-65,535 for each of the Red, Green, and Blue channels.
(Or more practically as applied, an extra 255 graduations of each 8-bit channel value. The duplicate graduation of each 8bit value already exists since #ffbb11 and #ffffbbbb1111 are effectively the same color. Using the 00 or ff to expand would orphan 255 gradients at the top or bottom of the spectrum.)