3

I have a Label for which I want to set the foreground color. However, there is also a white shadow/outline:

Example

I've set the Foreground to a color (Blue):

// This is GTK# in MonoDevelop on Mac OS X
var fg = new Gdk.Color ();
Gdk.Color.Parse ("#0000ff", ref fg);

lbl.ModifyFg (StateType.Normal, fg);
lbl.ModifyFg (StateType.Active, fg);
lbl.ModifyFg (StateType.Prelight, fg);

But I can't seem to find the option for the Shadow/Outline.

Does anyone know which setting I'm missing? (Answers for GTK+ in C/C++ are also okay, I just need to know what I'm actually looking for)

Michael Stum
  • 177,530
  • 117
  • 400
  • 535

1 Answers1

1

If you are using GTK+3 (as you should) you can disable text shadows on every GtkLabel by using the following CSS fragment:

GtkLabel {
    text-shadow: none;
}

That CSS can be put in the main GTK+3 file (usually $XDG_CONFIG_HOME/gtk-3.0/gtk.css) to affect all the applications or it can be dynamically loaded from your application using something along the lines of the following (untested) C code:

const gchar *css = "...your custom CSS here...";
GtkCssProvider *provider = gtk_css_provider_new();
if (gtk_css_provider_load_from_data(provider, css, -1, NULL)) {
    GdkScreen *screen = gdk_screen_get_default();
    gtk_style_context_add_provider_for_screen(screen, provider,
                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
}
g_object_unref(provider);
ntd
  • 7,372
  • 1
  • 27
  • 44