Possible Api for private colors

Hey, recently I have been thinking about the possibility to modifythe colors in for example TeamMonitor, currently the team monitor takes an “ideal blue” and mixes this with the document text color to create the blue text color for instance.
(ref: https://git.haiku-os.org/haiku/commit/?id=4b1f514b08ec4ee5c082a7907358c60be537d418)

This however cannot be changed in a theme or the preferences currently, the blueish text in team monitor would always be a calculated blue.

My idea would be to add an API with which applications can define private color constant names and expose this via get_suites, an app like ThemeManager could then display this choice for specific applications, and the app_server save and send saved values for these private color constants per application mimetype.
In the application code one would then use the received color and use that instead of the calculated color value.

Is such an api needed? do theme creators need this kind of control?
If this is a usefull API i will try to implement this during the coding sprint.

In some cases, it would be better indeed to use such private colours instead of using fixed colours or using text colours that are intended for a different background colour.
The risk is to end up with a lot more sliders. Perhaps you should limit that to a certain number per app so people don’t abuse of that functionality by making everything private.
Maybe simply adding two alternate text colours would be sufficient for most uses; one for documents and another for panels. Anyway, you will hide all sliders.

It might make it easier to support theming them, no need to write plugins like I had to for Pe colors in ThemeManager…

Or maybe we could just standardize more ui_colors including syntax highlight ones and have apps use them. Having a fixed list always risks missing some. OTOH, having an open list like we do for system sounds with arbitrary names, well, we barely do have apps using them but almost no theme setting all those correctly (because the one designing the theme must have those apps), or apps reusing ones when it makes sense. It’s a quite classic dilemma I think.

2 Likes

I don’t think that is completely viable. for example aboutsystem has “be inc red” and “be inc blue” for the BE text, Debugger has a big array of colors for highlighting certain gramatical elements in sourcecode, koder has yet different ones. Terminal has “ansi red”
For some of those we can probably make specific “global” colors, but I don’t think this makes sense for all of them.
edit: email also has quote level colors which seem fairly unique in purpose
I hope that with an api we would get a consistent way to configure colors where the author did not think that OS colors were sufficient. one can always add more constants later if it becomes apparent that one color is used frequently I’d think.