I have tried to set color of Gtk::Levelbar by using override_color() method of class but it not worked.
then I had tried by using css style by provider by loading css file (my_style.css).
csprovider->load_from_path(“my_style.css”);
cat my_style.css
{
color: rgba(83,165,198,255);
background: #669999 ;
}
by using above css file,I can able to change background color but i can not chnage color of level bar.
please help me on this.
ebassi
(Emmanuele Bassi)
November 11, 2020, 11:30am
2
The selectors used by GtkLevelBar
are described in the class documentation .
can you please explain me in detail ?
matthiasc
(Matthias Clasen)
November 11, 2020, 2:07pm
4
1 Like
ebassi
(Emmanuele Bassi)
November 11, 2020, 2:20pm
5
The documentation is kind of self-explanatory, but this should give you an idea:
levelbar block.low {
background-color: blue;
}
levelbar block.high {
background-color: magenta;
}
Each block in the level bar has a block
CSS selector; each level has a CSS class with its own name attached to it.
You should also use the inspector to check the CSS style classes and selectors applied to a widget.
1 Like
Thanks.I will look into it.
do you have simiilar kind of example in gtkmm? because i am using gtkmm
I can not compile suggested example.gcc through errors.
I believe that this code will work on GTK3+.
gcc pkg-config --cflags gtk+-3.0
-o testlevelbar testlevelbar.c pkg-config --libs gtk+-3.0
please help me on this.
arnaudb
(Arnaud B.)
November 12, 2020, 10:19am
10
Matthias linked the code from the master
branch, but as you’re using Gtk3, you should use the gtk-3-24
one instead, so here .
1 Like
Do you have same thing in gtkmm ?
arnaudb
(Arnaud B.)
November 18, 2020, 9:44am
12
There are surely more Gtk demos in C than in every other language, you probably should adapt yourself to translate them into your language of choice.
But even without translating this demo, you should have a look to the CSS part, as IIUC that’s where your problem lives. CSS works in a way where the more specific rule wins, so you have to find the correct specifier (equal or higher to what the default theme uses) to color a given element. Recheck @ebassi ’s comment, that should help you.
1 Like
I have translated C code into gtkmm and it works for me.
Thank you @arnaudb and @ebassi .
Do you know how to change boarder color of levelbar ?
Do you know how to change boarder color of levelbar ?
system
(system)
Closed
December 3, 2020, 6:57am
16
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.