Gtk3 override_color doesn't work

Hi, I work on a project using Gtk3 & Ruby. I want to change colors of
button and check button. So I tried like below:

checkBut = Gtk::CheckButton.new(“Png”)
button = Gtk::Button.new(:label => “Cancel”)

color= Gdk::RGBA.new(2142, 42886, 46590, 65535)
button.override_color(:normal, color)
checkBut.override_color(:normal, color)

I couldn’t change colors. Also I’ve tried override_background_color but
it doesn’t change. Can you suggest me something? How can I resolve the
problem?

Thanks.

Subject: [ruby-gnome2-devel-en] gtk3 override_color doesn’t work
Date: ven 06 dic 13 08:28:07 +0100

Quoting Ebru A. ([email protected]):

Hi, I work on a project using Gtk3 & Ruby. I want to change colors of
button and check button.

I do that (change the background color) like this:

color=Gdk::RGBA::new(1.0,0.3,0.3,1.0)
button.override_background_color(0,color)

Carlo

  •     Se la Strada e la sua Virtu' non fossero state messe da 
    

parte,

  • K * Carlo E. Prelz - [email protected] che bisogno ci
    sarebbe
    •           di parlare tanto di amore e di rettitudine? 
      

(Chuang-Tzu)

I do that (change the background color) like this:

color=Gdk::RGBA::new(1.0,0.3,0.3,1.0)
button.override_background_color(0,color)

Carlo

I tried as your suggestion but it doesn’t change.

Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn’t work
Date: ven 06 dic 13 08:40:25 +0100

Quoting Ebru A. ([email protected]):

I do that (change the background color) like this:

color=Gdk::RGBA::new(1.0,0.3,0.3,1.0)
button.override_background_color(0,color)

I tried as your suggestion but it doesn’t change.

Mah?!? Here it does (on Linux).

Carlo

  •     Se la Strada e la sua Virtu' non fossero state messe da 
    

parte,

  • K * Carlo E. Prelz - [email protected] che bisogno ci
    sarebbe
    •           di parlare tanto di amore e di rettitudine? 
      

(Chuang-Tzu)

Mah?!? Here it does (on Linux).

Carlo

I’m using Ubuntu 13.04 Xfce.

Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn’t work
Date: ven 06 dic 13 08:49:27 +0100

Quoting Ebru A. ([email protected]):

I’m using Ubuntu 13.04 Xfce.

Here I am on Debian Sid, and I use Mate. But I used to use Xfce, and
that code worked there too.

You may want to submit the actual code…

Carlo

  •     Se la Strada e la sua Virtu' non fossero state messe da 
    

parte,

  • K * Carlo E. Prelz - [email protected] che bisogno ci
    sarebbe
    •           di parlare tanto di amore e di rettitudine? 
      

(Chuang-Tzu)

Here I am on Debian Sid, and I use Mate. But I used to use Xfce, and
that code worked there too.

You may want to submit the actual code…

Carlo

require ‘gtk3’

w = Gtk::Window.new

layout = Gtk::Layout.new
checkBut = Gtk::CheckButton.new(“Png”)
button = Gtk::Button.new(:label => “Cancel”)

color=Gdk::RGBA::new(1.0,0.3,0.3,1.0)
button.override_background_color(0,color)
w.signal_connect(‘destroy’){Gtk.main_quit}
w.set_size_request(350, 350)

layout.put(checkBut, 80, 100)
layout.put(button, 80, 150)

w.add(layout)
w.show_all
Gtk.main

Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn’t work
Date: ven 06 dic 13 08:59:12 +0100

Quoting Ebru A. ([email protected]):

button.override_background_color(0,color)
w.signal_connect(‘destroy’){Gtk.main_quit}
w.set_size_request(350, 350)

layout.put(checkBut, 80, 100)
layout.put(button, 80, 150)

w.add(layout)
w.show_all
Gtk.main

I ran your code. The ‘Cancel’ button is red. See attached screen dump.

If it is not red in your case, maybe you have some restrictive
configuration… It never happened to me though.

Carlo

I ran your code. The ‘Cancel’ button is red. See attached screen dump.

If it is not red in your case, maybe you have some restrictive
configuration… It never happened to me though.

Carlo

I added screenshot. One more question, I’ll try to change my
configuration but I don’t understand meaning:

color=Gdk::RGBA::new(1.0,0.3,0.3,1.0)

1.0, 0.3 … How can you detect theese are supply red color? I want to
learn, it is necessary for my project. I should supply a few different
colors.

Thanks.

Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn’t work
Date: ven 06 dic 13 09:22:11 +0100

Quoting Ebru A. ([email protected]):

I added screenshot. One more question, I’ll try to change my
configuration but I don’t understand meaning:

color=Gdk::RGBA::new(1.0,0.3,0.3,1.0)

1.0, 0.3 … How can you detect theese are supply red color? I want to
learn, it is necessary for my project. I should supply a few different
colors.

To generate a RGBA colour you must provide four values: red, green,
blue, and A (the transparency value). The values must be between 0 and

  1. So, 1,0,0,1 is pure red, 0,1,0,1 is pure green, etc… 1,0.3,0.3,1 is
    full red plus one third of green and blue (gives a light red - almost
    pink). If your fourth value is less than 1, it is as if your paint
    were more and more transparent - a value of 0 gives always the basic
    grey,
    regardless of the other three values.

  •     Se la Strada e la sua Virtu' non fossero state messe da 
    

parte,

  • K * Carlo E. Prelz - [email protected] che bisogno ci
    sarebbe
    •           di parlare tanto di amore e di rettitudine? 
      

(Chuang-Tzu)

To generate a RGBA colour you must provide four values: red, green,
blue, and A (the transparency value). The values must be between 0 and

  1. So, 1,0,0,1 is pure red, 0,1,0,1 is pure green, etc… 1,0.3,0.3,1 is
    full red plus one third of green and blue (gives a light red - almost
    pink). If your fourth value is less than 1, it is as if your paint
    were more and more transparent - a value of 0 gives always the basic
    grey,
    regardless of the other three values.


Ok, thanks and I dont know where can i change this configuration. Can
you suggest me something for changing configuration?

Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn’t work
Date: ven 06 dic 13 09:44:25 +0100

Quoting Ebru A. ([email protected]):

Ok, thanks and I dont know where can i change this configuration. Can
you suggest me something for changing configuration?

I believe it has to do with the theme you selected. Try changing
that. But it’s a question of trial and error…

Carlo

  •     Se la Strada e la sua Virtu' non fossero state messe da 
    

parte,

  • K * Carlo E. Prelz - [email protected] che bisogno ci
    sarebbe
    •           di parlare tanto di amore e di rettitudine? 
      

(Chuang-Tzu)