# Progressbar color?

**URL:** <https://www.ruby-forum.com/t/progressbar-color/138121>\
**Category:** Ruby-Gnome 2\
**Created:** [May 20, 2008, 12:17pm UTC](https://www.ruby-forum.com/t/progressbar-color/138121 "2008-05-20T12:17:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 20, 2008, 12:17pm UTC](https://www.ruby-forum.com/t/progressbar-color/138121/1 "2008-05-20T12:17:35Z")

</div>

hi, this is a basic problem I think but I try to do this for long time.  
after I declare

progress = ProgressBar.new

I use

progress.modify\_fg(STATE\_NORMAL,Gdk::Color.new(240_255,208_255,215\*255))

but it’s nothing happen

and when I do

progress.modify\_bg(STATE\_NORMAL,Gdk::Color.new(240_255,208_255,215\*255))

color of background of progress bar is a color but I want color at bar  
how can I do that?? see my picture for detail.

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 20, 2008, 4:19pm UTC](https://www.ruby-forum.com/t/progressbar-color/138121/2 "2008-05-20T16:19:40Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] progressbar color??” on Tue, 20 May 2008  
12:17:35 +0200,  
Pat K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> progress.modify\_fg(STATE\_NORMAL,Gdk::Color.new(240_255,208_255,215\*255))
> 
> but it’s nothing happen
> 
> and when I do
> 
> progress.modify\_bg(STATE\_NORMAL,Gdk::Color.new(240_255,208_255,215\*255))
> 
> color of background of progress bar is a color but I want color at bar  
> how can I do that?? see my picture for detail.

Use Gtk::STATE\_PRELIGHT.

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 20, 2008, 5:04pm UTC](https://www.ruby-forum.com/t/progressbar-color/138121/3 "2008-05-20T17:04:27Z")

</div>

2008/5/20 Kouhei S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> “[ruby-gnome2-devel-en] progressbar color??” on Tue, 20 May 2008 12:17:35 +0200,  
> Pat K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > [snipped]  
> > color of background of progress bar is a color but I want color at bar  
> > how can I do that?? see my picture for detail.
> 
> Use Gtk::STATE\_PRELIGHT.

IIRC, there’s no guarantee that this will work: it will depend on the  
GTK theme the user has configured. (Pixmap themes, for example, will  
definitely ignore this - the progress bar is simply an composite of  
bitmaps).

If having a particular colour for the bar is really essential, it  
would be safer to draw your own using cairo.

HTH,

Geoff.

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 20, 2008, 5:12pm UTC](https://www.ruby-forum.com/t/progressbar-color/138121/4 "2008-05-20T17:12:12Z")

</div>

Le mardi 20 mai 2008 à 16:03 +0100, Geoff Y. a écrit :

> IIRC, there’s no guarantee that this will work: it will depend on the  
> GTK theme the user has configured. (Pixmap themes, for example, will  
> definitely ignore this - the progress bar is simply an composite of  
> bitmaps).
> 
> If having a particular colour for the bar is really essential, it  
> would be safer to draw your own using cairo.

You can also enforce the theme for that widget

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 26, 2008, 5:47pm UTC](https://www.ruby-forum.com/t/progressbar-color/138121/5 "2008-05-26T17:47:33Z")

</div>

thank you! STATE\_PRELIGHT is work!! and I want to know what’s different  
of STATE\_PRELIGHT and STATE\_NORMAL??

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 20, 2008, 5:36pm UTC](https://www.ruby-forum.com/t/progressbar-color/138121/6 "2008-05-20T17:36:00Z")

</div>

2008/5/20 Pat K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> and when I do
> 
> progress.modify\_bg(STATE\_NORMAL,Gdk::Color.new(240_255,208_255,215\*255))
> 
> color of background of progress bar is a color but I want color at bar  
> how can I do that?? see my picture for detail.

Hi all, I’ve just joined the list.

Try calling progress.modify\_bg with STATE\_PRELIGHT instead of  
STATE\_NORMAL.

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [May 27, 2008, 12:27am UTC](https://www.ruby-forum.com/t/progressbar-color/138121/7 "2008-05-27T00:27:57Z")

</div>

On Mon, May 26, 2008 at 5:47 PM, Pat K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> thank you! STATE\_PRELIGHT is work!! and I want to know what’s different  
> of STATE\_PRELIGHT and STATE\_NORMAL??

There’s API documentation for that.

[http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk#GtkStateType](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk#GtkStateType)

–  
Guillaume C. - [NVC Communication Obstacles Game](http://zarb.org/~gc/)
