Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have noticed that i can only change the foreground color of a gtk2.0 theme button with the "default" style.

I did it like:

style "default" {
    fg[NORMAL]        = "#000000"
    fg[PRELIGHT]      = "#000000"
    fg[SELECTED]      = "#000000"
    fg[INSENSITIVE]   = "#000000"
    fg[ACTIVE]        = "#000000"
}

class "GtkWidget" style "default"

style "button" {
    fg[NORMAL] = "#FF0000"
    fg[ACTIVE] = "#FF0000"
    fg[PRELIGHT] = "#FF0000"
    fg[INSENSITIVE] = "#FF0000"
}
widget_class "*GtkText" style "button"
class "GtkButton" style "button"
widget_class "*GtkButton*" style "button"

The 3 assignments are to test if any work but the button text and all the other text color are black how it is defined within the "default" style.

I tried to look if a foreground color can be changed in other widgets and it does.

For a list view i could change the foreground color of the header columns (where i can sort the list)

If i change the fg[NORMAL] within the default style to "#FF0000" the button will get red like expected but also any other text too which is also expected.

Can anybody tell me how i can change only the foreground color of a gtk2.0 button?

EDIT I forgot to tell that if i change the background image using pixmap engine the background images appeared so the "style assignation" work well but the fg color will not be overridden.

Edit To provide you more information:

I have installed the latest gtk3 and gtk2 libs/engines (apt-get upgrade)

Also i tried (additional to the gtk2.0 theme settings) the gtk3.0 settings for the css selector:

button, 
GtkButton, 
button.default, 
GtkButton.default, 
button *, 
GtkButton *
button.default *, 
GtkButton.default *,  
{ 
    color: #FF0000; 
}

button:hover, 
GtkButton:hover, 
button:hover *, 
GtkButton:hover *,
button.default:hover, 
GtkButton.default:hover, 
button.default:hover *, 
GtkButton.default:hover * 
{ 
    color: #FF0000; 
}

button:active, 
GtkButton:active, 
button:active *, 
GtkButton:active *,
button.default:active, 
GtkButton.default:active, 
button.default:active *, 
GtkButton.default:active * 
{ 
    color: #FF0000; 
}

button:hover:active, 
GtkButton:hover:active, 
button:hover:active *, 
GtkButton:hover:active *,
button.default:hover:active, 
GtkButton.default:hover:active, 
button.default:hover:active *, 
GtkButton.default:hover:active * 
{ 
    color: #FF0000; 
}

This also has no effects.

My System is

  • Ubuntu 12.04
  • Gnome3 classic mode with effects
  • WindowManager: emerald
share|improve this question
    
What distro are you using? –  Stephen Myall Jul 23 '12 at 18:49
    
I'm using ubuntu 12.04 with gnome3 classic with effects, window manager = emerald –  prdatur Jul 23 '12 at 18:50

1 Answer 1

You probably need to be using the GTK3 themes then.

Many applications don’t support GTK2 any more. Most themes are compiled with both GTk3 and 2 variants to support newer and older applications

share|improve this answer
    
This also does not work. i have added in the gtk3.0 .button (all states like :hover :active) GtkButton (also all states) and it doesn't effect. –  prdatur Jul 23 '12 at 19:25
    
You did not state this in your question. Can you revisit your question and edit it to give all information we need to help you. For example have you installed the latest gtk2-engine-pixbuf & latest gtk3-engines-unico –  Stephen Myall Jul 23 '12 at 19:38
1  
Edited the information in the main question. –  prdatur Jul 23 '12 at 19:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.