Created
August 6, 2023 12:45
-
-
Save omnp/56bcf4ff712db92d4bd6797e4a8955af to your computer and use it in GitHub Desktop.
Loading CSS from a string for GVim with GTK 3 gui
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c | |
| index 1f8b2ebcc..e216904fe 100644 | |
| --- a/src/gui_gtk_x11.c | |
| +++ b/src/gui_gtk_x11.c | |
| @@ -4059,6 +4059,28 @@ gui_mch_init(void) | |
| G_CALLBACK(gtk_settings_xft_dpi_changed_cb), NULL); | |
| } | |
| + if (GTK_IS_WIDGET(gui.mainwin)) | |
| + { | |
| + GdkScreen *screen = NULL; | |
| + GtkCssProvider *provider; | |
| + const gchar * css = | |
| + "window { background: #4a4a4a; }" | |
| + "toolbar { background: #4a4a4a; }" | |
| + "toolbar button { background: none; border: none; box-shadow: none; }" | |
| + "toolbar button image { background: none; border: none; box-shadow: none; transition: none; }" | |
| + "toolbar button:hover { background: #1d1d1d; }" | |
| + "menubar, menuitem { background: #303030; color: #707070; }" | |
| + "menuitem:hover { background: #1d1d1d; }" | |
| + "notebook * { background: #303030; color: #707070; border: none; }" | |
| + "scrollbar { background: #303030; color: #707070; border: none; }" | |
| + ; | |
| + provider = gtk_css_provider_new(); | |
| + screen = gtk_widget_get_screen(gui.mainwin); | |
| + gtk_css_provider_load_from_data(provider, css, -1, NULL); | |
| + gtk_style_context_add_provider_for_screen(screen, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); | |
| + g_object_unref(provider); | |
| + } | |
| + | |
| return OK; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment