Gtk3 CSS GtkTreeView column header color

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm using gtk+-3.2.3 with css on Ubuntu natty. In the code below I have a button that starts out with a background color of green with blue text. I set the background color for the hover state to red but the font color will not change to white as I've specified.
Also for the active:hover state the background color changes but the font color won't change to cyan that I've specified.
( I used hex for cyan, using the named color cyan is broken, same for silver http://en.wikipedia.org/wiki/X11_color_names )
Why is this happening? Is this the window manager over-riding my code?

/*Compile with:
  gcc -Wall -o cssbutton2 `pkg-config --cflags --libs gtk+-3.0` cssbutton2.c
*/


#include <gtk/gtk.h>

int main(int argc, char *argv[] )
{
 
GtkWidget *window;
 
GtkWidget *button;
 
GtkCssProvider *provider;
 
GdkDisplay *display;
 
GdkScreen *screen;

  gtk_init
(&argc, &argv);

  window
= gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size
(GTK_WINDOW(window), 280, 200);
  g_signal_connect
(GTK_WIDGET (window), "destroy",
                        G_CALLBACK
(gtk_main_quit), NULL);

  button
= gtk_button_new_with_label("CssButton");  
  gtk_widget_set_name
(GTK_WIDGET(button), "mybutton");        
  gtk_widget_set_halign
(GTK_WIDGET(button),GTK_ALIGN_CENTER);
  gtk_widget_set_valign
(GTK_WIDGET(button),GTK_ALIGN_CENTER);
  gtk_widget_set_size_request
(GTK_WIDGET(button), 200, 120);
  gtk_container_add
(GTK_CONTAINER(window),button);

  provider
= gtk_css_provider_new ();
  display
= gdk_display_get_default ();
  screen
= gdk_display_get_default_screen (display);                                                                                  
  gtk_style_context_add_provider_for_screen
(screen, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_USER);

  gtk_css_provider_load_from_data
(GTK_CSS_PROVIDER (provider),
                           
" GtkWindow {\n"                          
                           
"   background-color: tan;\n"
                           
"}\n"
                           
" GtkButton {\n"
                           
"   -GtkWidget-focus-line-width: 0;\n"
                           
"   border-radius: 15;\n"
                           
"   font: Sans 23;\n"
                           
"   color: #00008B;\n"                                      
                           
"   background-color: green;\n"
                           
"}\n"
                           
" .button:hover {\n"
                           
"   background-color: red;\n"
                           
"   color: white;\n"
                           
"}\n"
                           
" .button:hover:active {\n"
                           
"   background-color: orange;\n"
                           
"   color: #00FFFF;\n"
                           
"}\n", -1, NULL);

  g_object_unref
(provider);
  gtk_widget_show_all
(window);
  gtk_main
();
 
return(0);
}

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux