c gtk3 style - button's background doesn't change

I wrote program using GTK3 with css styling and it works perfect on my KDE. But problem is that on ubuntu and windows 10 styling only works partially. I have css file like this:

window {
    background-color: white;
}
button {
    border: none;
    color: white;
    padding: 15px 32px;
    text-decoration: none;
    font-size: 16px;
    background-color: #555555;
}

Everything works except changing background of buttons. It's how I load css:

GtkCssProvider *provider = gtk_css_provider_new ();
gtk_css_provider_load_from_path (provider, "styles.css", NULL);

gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
                        GTK_STYLE_PROVIDER(provider),
                        GTK_STYLE_PROVIDER_PRIORITY_USER);

How can I make it work?

Upvotes: 1

Views: 809

Answers (2)

asukiaaa
asukiaaa

Reputation: 1674

You can change by writing css on ~/.config/gtk-3.0/gtk.css.

button.titlebutton.close:backdrop {
  background-color: transparent;
}

button.titlebutton.close {
  background-color: @theme_selected_bg_color;
}

References:

Upvotes: 0

I found solution:

window {
    background-color: white;
}
button {
    border: none;
    padding: 0px;
    text-decoration: none;
    font-size: 16px;
}
button > label{
    padding: 15px 32px;
    background-color: #555555;
    color: white;
}

Upvotes: 1

Related Questions