agl / pond

Pond
BSD 3-Clause "New" or "Revised" License
912 stars 109 forks source link

Add explicit colors to labels, buttons and entries. Make colors role based #65

Open olabini opened 10 years ago

olabini commented 10 years ago

The Pond GUI currently is almost unusable if you have changed the theme to different colors. (For example the Gnome 3 dark theme). As a first step to fixing this, these commits refactor the GUI to use role based colors only, and explicitly setting the colors in all places where necessary.

There are still some issues. Specifically, the main background of the UI, the background of buttons and entries doesn't seem to honor the widgetBase background specification at all - not sure why this happens.

agl commented 10 years ago

I'd certainly like to get thinks working better on non-default color schemes (although I can't see how to switch GNOME 3 to a different theme).

However, these changes are adding huge amounts of noise to gui.go. Go defaults all values to zero so defaults can be implemented in gtk.go without needing to set the colors of every Label. Also, I would suspect (although I've no idea) that GTK has some standard way to set colors based on the theme, no? I fully admit that the current code is probably wrong for non-default colors and I should probably read the GTK docs about it.

olabini commented 10 years ago

That's all fair feedback. =) This is the info I've found so far: You change the theme in Gnome 3 using the gnome-tweak-tool. The standard theme has a default dark version which is the one I'm using.

GTK will use the color from the operating system/WM if you don't set it explicitly, OR you set it to 0. The problem with this is that if you set some of the colors, like the foreground for headers, but nothing else, that means the headers will always have the right color, but the places where you haven't explicitly set the color will use the theme color. That means you can end up with dark font color on dark background very easily.

It seems to me that the only solution is to set ALL the colors explicitly, or set none of them. There might exist an inbetween, but I haven't seen it.

(This is why I set all of the values explicitly in the patch, even though they will sometimes be 0).

I'll continue looking at it and see if I can figure out a better solution. How wedded are you to the current color scheme you're using?

agl commented 10 years ago

I flipped over to the dark theme and I agree that it's a mess. I also tried disabling all color settings and that's a disaster in every case, so some colors need to be set.

However, having different "themes" in Pond seems like the wrong approach. Rather I think the colors perhaps should be symbolic and resolved via the GTK theme. The Dark theme clearly has a concept of background colors etc. It's perfectly fine for the Pond colors to change somewhat to match.

I'm working on a Cocoa UI at the moment but, if I were playing with this then I think I'd start by poking gtk_style_context_get_background_color, and similar functions, which might do what's needed.

burdges commented 10 years ago

I'd trouble controlling the border of a widget, and finding the right font. See the code and comments here : https://github.com/burdges/pond/commit/e95448323bb6951192144c8aa2de3ef8c99bb223#commitcomment-5178089 which might be another case of wanting to resolve widget properties via GTK's CSS-like system, which I think might be what agl just said. :)