Forum: Ruby-Gnome 2 gtk3 override_color doesn't work

Ff312ec21b0fd1d07c8708e29df7d242?d=identicon&s=25 Ebru Akagunduz (ebruakagunduz)
on 2013-12-06 20:28
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.
3853dd5371ac1e094fc45d6c2aa0e459?d=identicon&s=25 Carlo E. Prelz (Guest)
on 2013-12-06 20:34
(Received via mailing list)
Subject: [ruby-gnome2-devel-en] gtk3 override_color doesn't work
  Date: ven 06 dic 13 08:28:07 +0100

Quoting Ebru Akagunduz (ruby-forum-incoming@andreas-s.net):

> 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 - fluido@fluido.as             che bisogno ci
sarebbe
  *               di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
Ff312ec21b0fd1d07c8708e29df7d242?d=identicon&s=25 Ebru Akagunduz (ebruakagunduz)
on 2013-12-06 20:40
> 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.
3853dd5371ac1e094fc45d6c2aa0e459?d=identicon&s=25 Carlo E. Prelz (Guest)
on 2013-12-06 20:47
(Received via mailing list)
Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn't work
  Date: ven 06 dic 13 08:40:25 +0100

Quoting Ebru Akagunduz (ruby-forum-incoming@andreas-s.net):

> > 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 - fluido@fluido.as             che bisogno ci
sarebbe
  *               di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
Ff312ec21b0fd1d07c8708e29df7d242?d=identicon&s=25 Ebru Akagunduz (ebruakagunduz)
on 2013-12-06 20:49
> Mah?!? Here it does (on Linux).
>
> Carlo
>
> --

I'm using Ubuntu 13.04 Xfce.
3853dd5371ac1e094fc45d6c2aa0e459?d=identicon&s=25 Carlo E. Prelz (Guest)
on 2013-12-06 20:54
(Received via mailing list)
Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn't work
  Date: ven 06 dic 13 08:49:27 +0100

Quoting Ebru Akagunduz (ruby-forum-incoming@andreas-s.net):

> 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 - fluido@fluido.as             che bisogno ci
sarebbe
  *               di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
Ff312ec21b0fd1d07c8708e29df7d242?d=identicon&s=25 Ebru Akagunduz (ebruakagunduz)
on 2013-12-06 20:59
> 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
3853dd5371ac1e094fc45d6c2aa0e459?d=identicon&s=25 Carlo E. Prelz (Guest)
on 2013-12-06 21:10
(Received via mailing list)
Attachment: d.jpg (5 KB)
Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn't work
  Date: ven 06 dic 13 08:59:12 +0100

Quoting Ebru Akagunduz (ruby-forum-incoming@andreas-s.net):

> 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
Ff312ec21b0fd1d07c8708e29df7d242?d=identicon&s=25 Ebru Akagunduz (ebruakagunduz)
on 2013-12-06 21:22
Attachment: ruby_gtk3_color_try.png (60 KB)
> 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.
3853dd5371ac1e094fc45d6c2aa0e459?d=identicon&s=25 Carlo E. Prelz (Guest)
on 2013-12-06 21:30
(Received via mailing list)
Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn't work
  Date: ven 06 dic 13 09:22:11 +0100

Quoting Ebru Akagunduz (ruby-forum-incoming@andreas-s.net):

> 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 - fluido@fluido.as             che bisogno ci
sarebbe
  *               di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
Ff312ec21b0fd1d07c8708e29df7d242?d=identicon&s=25 Ebru Akagunduz (ebruakagunduz)
on 2013-12-06 21:44
> 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?
3853dd5371ac1e094fc45d6c2aa0e459?d=identicon&s=25 Carlo E. Prelz (Guest)
on 2013-12-06 22:52
(Received via mailing list)
Subject: Re: [ruby-gnome2-devel-en] gtk3 override_color doesn't work
  Date: ven 06 dic 13 09:44:25 +0100

Quoting Ebru Akagunduz (ruby-forum-incoming@andreas-s.net):

> 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 - fluido@fluido.as             che bisogno ci
sarebbe
  *               di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.