After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 704686 - Standardize timeline colors with constants
Standardize timeline colors with constants
Status: RESOLVED FIXED
Product: pitivi
Classification: Other
Component: Timeline
Git
Other Linux
: Normal minor
: 0.91
Assigned To: Jean-François Fortin Tam
Pitivi maintainers
Depends on:
Blocks: 682886
 
 
Reported: 2013-07-22 14:20 UTC by Jean-François Fortin Tam
Modified: 2013-08-02 16:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jean-François Fortin Tam 2013-07-22 14:20:48 UTC
Pitivi has been traditionally doing style.get_background_color(Gtk.StateFlags.NORMAL)    (or stateflags ACTIVE) to find the theme's color to apply to the timeline ruler.

The problem is that this doesn't work at all with GTK3. You always get pure black (RGB 0, 0, 0) when you do that, even if you do style.lookup_color("bg_color").

From the discussion below, it seems clear that we have no choice but to define all our timeline colors from scratch instead of trying to derive them from themes. Which is somewhat OK with me now that GNOME standardized on Adwaita (see: "Advaita", "the one and only", etc.).


-------

<ebassi> the fact that it's returning a GdkColor makes me thing that it's an old GtkStyle API
 or some sort of weird back-compatibility function
 unless somebody meant to make GdkRGBA match GdkColor
 and vice versa
<nekohayo> no idea what's the "proper" way to ask gtk for the theme's various colors? :)
<ebassi> nekohayo: that's usually something you don't do
 nekohayo: you ask for the color for that particular widget
 nekohayo: and the theme is either setting that color explictly or it's using a symbolic color
 nekohayo: but you don't just ask a generic color
<nekohayo> ebassi, I'm not sure how to figure out colors for pitivi's clutter timeline widget (or its cairo/goocanvas ruler widget that has not yet been ported to clutter)
 unless I should officially stop bothering about even trying to get the theme colors, and hardcode everything :/
<ebassi> you should stop bothering
 and ship a theme with your app for your custom appearance
<nekohayo> you mean a whole custom gtk theme just for pitivi? that's madness
<ebassi> not a whole custom theme: a theme only for the custom widgets you have
 but in general, that's how CSS works
<nekohayo> hm, you mean "in the app", define a small portion of css just for my own widgets
 ........which pretty much amounts to the same thing as having a couple of constants at the top of the file where I hardcode the colors
<ebassi> nekohayo: yes, but with CSS you don't need to recompile your app
<nekohayo> well, it's python :P
<ebassi> s/recompile/re-install/
<nekohayo> (and it runs in-place)
<ebassi> but yep
<nekohayo> alright
 I guess it will look alien if users don't use Adwaita but it sounds like that "can't be avoided"
<ebassi> in theory, by using CSS, you can ship with different versions of the UI yourself, matching the currently used theme
 so you can check if you're running under Adwaita, or Unico, or the HighContrast theme
 and load the appropriate CSS snippet
 but you can do the same by hardcoding colors as well
<nekohayo> how do you even ask gtk what theme it is running? ;)
<ebassi> nekohayo: GtkSettings:theme-name
<nekohayo> oh
<ebassi> but that's how CSS works: we don't define a bunch of colors for you to peek at. we define the whole appearence of the UI. you either use standard controls, and conform to that; or you create your own appearance for the non-standard controls
CSS is about freedom ;-)
<nekohayo> ebassi, well the idea would be to clone/steal another widget's color palette
<ebassi> nekohayo: that can only work for CSS classes, not for widgets
<ebassi> nekohayo: but if the specificity of the CSS selector is based on the widget class, or on a widget's name, then you need to be that widget
<ebassi> in order to get out the CSS style properties
<nekohayo> no widget impersonation
<ebassi> it's like the web: if you want a blockquote to look like a div, they need to share a class; but if the CSS is in terms of blockquote and div, then there's nothing you can do about it



--------
While we're at it, I'm not sure how useful it is to provide color preferences for the timeline elements again. If someone comes up with a nice patch I'll consider it.
Comment 1 Jean-François Fortin Tam 2013-08-02 16:50:09 UTC
Alright, pushed the initial cleanup patches. If someone wants to do further work on this (to implement the ability for users to have a custom CSS stylesheet in their ~/.config/pitivi folder, or have something that takes various themes/accessibility into account), be my guest.


commit 69d3dcac2a24bc0eac8d23a0a0ad973feb411802
Author: Jean-François Fortin Tam <nekohayo@gmail.com>
Date:   Fri Aug 2 17:30:08 2013 +0200

    Standardize timeline colors with constants and fix the ruler's bg color
    
    Fixes bug #704686

commit 6599953195511ff8568c9c7af276e6b3696ddabd
Author: Jean-François Fortin Tam <nekohayo@gmail.com>
Date:   Fri Aug 2 17:23:59 2013 +0200

    timeline/elements: Improve the appearance and visibility of the keyframe curves
    
    - Use a better default color (Tango yellow) for the lines
    - Draw a "shadow" above and below the lines
    - Improve the lines' height calculations by standardizing on keyframe heights