Re: Changing the progress bar color



Havoc Pennington <hp redhat com> writes:

> Jerry Mulchin <jmulchin astroguy com> writes:
> > I'm trying to change the progress bar's color from the default dark gray
> > to various colors, depending on what's going on behind the scenes. Is
> > there an easy way to do this, like a gtk function call to just set it?
> > 
> 
> Set it as you would for any widget, only you are changing the "active"
> color instead of the "foreground" color I think.
> 
> (The way you'd do it for any widget is to create a GtkRcStyle, set the
> bits for the states/colors to change, call gtk_widget_modify_style(),
> and unref the rc style.)

The colors used are actually the bg[PRELIGHT] for the trough and
the bg[NORMAL] for the background.

The reason why Havoc is thinking that it might be the active color is
that the Red Hat GTK+ package includes the fragment in /etc/gtk/gtkrc.


style "gtk-progressbar-style" {
  bg[NORMAL] = "#ffffff"
  bg[PRELIGHT] = "#a0a0a0"
}

class "GtkProgressBar" style "gtk-progressbar-style"


To provide some more contrast. So, on Red Hat, at least, the bar is
dark by default, even though it is drawn with the prelight color.

But, yes, gtk_widget_modify_style() is the right way to override these
colors in a program. (Sounds a little ugly to me, but tastes vary.)

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]