Re: Tooltip over dark background

2016-06-14 Thread Stefan Salewski
On Tue, 2016-06-14 at 22:50 +0200, infirit wrote:
> Unfortunately documentation is really sparse

Thanks for your reply.

After some testing I have indeed been able to get black text on white
background with this Nim code:

const
  str0 = ".tooltip {background-color: #fff; color: #000; \n}"

proc setTTColor() =
  var error: GError
  var provider: CssProvider = newCssProvider()
  var display: Display = displayGetDefault()
  var screen: gdk3.Screen = getDefaultScreen(display)
  styleContextAddProviderForScreen(screen, styleProvider(provider), 
STYLE_PROVIDER_PRIORITY_APPLICATION.cuint);
  discard loadFromData(provider, str0, GSize(-1), error)
  if error != nil:
echo error.message
  objectUnref(provider);


___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Re: Tooltip over dark background

2016-06-14 Thread infirit
Op 06/14/2016 om 10:08 PM schreef Stefan Salewski:
> There seems to be no easy solution. Getting the GtkSourceView colors is
> not easy, and setting the tooltip colors may be really hard. Plain
> color setting is deprecated generally, so we have to use CSS I guess.
> Maybe the only way is Pango markup? Well, may result in a whole day of
> work, maybe a whole weekend, and maybe still not work :-(

Unfortunately documentation is really sparse and it took my some effort
to figure this out. What you are supposed to do is create a style
provider and use it to load some css with colors and effects you want.
What I did is the following:

  * Set a unique widget names which we can use in the css.
  * Create css which uses these unique widget names (eg
#MyUniqueWidgetName GtkTreeView:selected)
  * Create a GtkStyleProvider and load the css (css can be inline or in
a file)
  * Attach the style provider to the GtkStyleContext

~infirit

___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list


Tooltip over dark background

2016-06-14 Thread Stefan Salewski
When I use a dark color scheme for GtkSourceView tooltips displaying
syntax errors look not really nice. For example I am using a color
scheme similar to this one currently:

http://ssalewski.de/tmp/NEd-SHD.png

Some weeks ago, when I still was using a light scheme, I could hover
over a syntax error (red underlined) and got the tooltip with black
background. Now I get the black tooltip still.

I have spent already two hours googling...

There seems to be no easy solution. Getting the GtkSourceView colors is
not easy, and setting the tooltip colors may be really hard. Plain
color setting is deprecated generally, so we have to use CSS I guess.
Maybe the only way is Pango markup? Well, may result in a whole day of
work, maybe a whole weekend, and maybe still not work :-(
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list