refactor dark theme detection into a function
This code is used three times in codebase https://gitlab.gnome.org/GNOME/gitg/blob/master/gitg/gitg-window.vala#L374-385
var dark = settings.gtk_application_prefer_dark_theme || (theme != null && theme.has_suffix(":dark"));
if (!dark) {
var stylecontext = get_style_context();
Gdk.RGBA rgba;
var background_set = stylecontext.lookup_color("theme_bg_color", out rgba);
if (background_set && rgba.red + rgba.green + rgba.blue < 1.0)
{
dark = true;
}
}
Refactor to ease maintenance (as dark theme detection could be improved in future)