coyim / coyim

coyim - a safe and secure chat client

Home Page:https://coy.im

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use abstract CSS colors everywhere

olabiniV2 opened this issue · comments

Right now, we are creating color sets that contain specific fields that map to colors, for example:

darkTheme := colorSet{
   rosterForeground: "#123456",
}

and then we use that directly. However, in order to move towards more flexibility in management of colors, we should move towards defining the colors using the GTK CSS constructs, and then refer to them instead. In practice, that would mean loading a CSS that contains something like this:

@define-color roster_background #0011ff;
@define-color roster_foreground #f9a039;

Then, the color set would simply be:

darkTheme := colorSet{
   rosterForeground: "@roster_foreground",
}

Which would allow us to use the same color set for dark and light themes. Instead, we would switch out the color definitions when changing color. The goal should be to move EVERY hard-coded color into these references, and then collect all the colors in one single place.

After some investigation it turns out this can't really be done. The problem is the GtkTreeView, which manually draws things directly. It doesn't actually use the Style Context to look up the colors, so no abstract color definitions are available.

For this reason, we can't do this for everything. But we can't do it for all places that are outside of tree views. It's also a good idea to extract the colors even for tree-views, to have them defined in one place. This temporary duplication is good since we will use them in #837.