diff --git a/share/ui/Adwaita-dark.css b/share/ui/Adwaita-dark.css new file mode 100644 index 0000000000000000000000000000000000000000..db89ba272a61c6db8636b3c76a8ac19f8421ac2e --- /dev/null +++ b/share/ui/Adwaita-dark.css @@ -0,0 +1,62 @@ +/* ADWAITA DARK SPECIFIC STYLE */ + +/* + * Keep as small as possible + */ + +spinbutton { + padding: 0; + outline-style: none; +} + +spinbutton entry { + padding-left: 2px; + padding-right: 0; +} + +spinbutton undershoot { + outline-style: none; +} + +spinbutton entry { + padding-left: 2px; + padding-right: 0; +} + +spinbutton undershoot { + outline-style: none; +} + +.inkswitch slider { + min-width: 18px; + min-height: 18px; +} + +.inkswitch image { + color: transparent; + background-color: transparent; + background-image: image(transparent); + -gtk-icon-style:symbolic; +} + +.inkswitch { + margin: 2px; + padding: 0; + font-size: 8px; +} + +/* Reduce width of +/- buttons. */ +.up, +.down { + padding-left: 0; + padding-right: 0; +} + +#monoStrokeWidth, +#fillEmptySpace, +#SelectStatus, +#CoordinateStatusX, +#CoordinateStatusY, +#DesktopMainTable spinbutton{ + font-family: sans-serif; +} \ No newline at end of file diff --git a/share/ui/Adwaita.css b/share/ui/Adwaita.css new file mode 100644 index 0000000000000000000000000000000000000000..ebec8d2ee7322b130cc2e501396c703a066a8f98 --- /dev/null +++ b/share/ui/Adwaita.css @@ -0,0 +1,63 @@ +/* ADWAITA SPECIFIC STYLE */ + + +/* + * Keep as small as possible + */ + +spinbutton { + padding: 0; + outline-style: none; +} + +spinbutton entry { + padding-left: 2px; + padding-right: 0; +} + +spinbutton undershoot { + outline-style: none; +} + +spinbutton entry { + padding-left: 2px; + padding-right: 0; +} + +spinbutton undershoot { + outline-style: none; +} + +.inkswitch slider { + min-width: 18px; + min-height: 18px; +} + +.inkswitch image { + color: transparent; + background-color: transparent; + background-image: image(transparent); + -gtk-icon-style:symbolic; +} + +.inkswitch { + margin: 2px; + padding: 0; + font-size: 8px; +} + +/* Reduce width of +/- buttons. */ +.up, +.down { + padding-left: 0; + padding-right: 0; +} + +#monoStrokeWidth, +#fillEmptySpace, +#SelectStatus, +#CoordinateStatusX, +#CoordinateStatusY, +#DesktopMainTable spinbutton{ + font-family: sans-serif; +} \ No newline at end of file diff --git a/share/ui/style.css b/share/ui/style.css index b103c323b6efeba580718ef61fe872387fc78753..46a4de0cd842bad3db8d45d90a0d39b40a73ea1b 100644 --- a/share/ui/style.css +++ b/share/ui/style.css @@ -122,6 +122,7 @@ color: inherit; } +/* atribute dialog popup size */ .attrpop textview { font-size: 13px; } @@ -149,29 +150,6 @@ color: @success_color; } -spinbutton { - padding: 0; - outline-style: none; -} - -spinbutton entry { - padding-left: 2px; - padding-right: 0; -} - -spinbutton undershoot { - outline-style: none; -} - -spinbutton entry { - padding-left: 2px; - padding-right: 0; -} - -spinbutton undershoot { - outline-style: none; -} - iconview *:hover { border-width: 1px; border-color: @theme_fg_color; @@ -187,23 +165,6 @@ iconview *:hover { font-size: 11px; } -.inkswitch slider { - min-width: 18px; - min-height: 18px; -} - -.inkswitch image { - color: transparent; - background-color: transparent; - background-image: image(transparent); - -gtk-icon-style:symbolic; -} - -.inkswitch { - margin: 2px; - padding: 0; - font-size: 8px; -} /* LPE Dialog add */ #LPESelectorFlowBox GtkFlowBoxChild, @@ -404,13 +365,6 @@ SPCanvas { padding-right: 0; } -/* Reduce width of +/- buttons. */ -.up, -.down { - padding-left: 0; - padding-right: 0; -} - /* InkSpinScale */ #InkSpinScale { background: @theme_bg_color; diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 030072df804d481e580e4ddcfb7f468f83efd90d..5a49b1ade3c9c554361b3d60d4bd3409b7a98cd0 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -558,7 +558,6 @@ void Application::add_gtk_css() // Add style sheet (GTK3) auto const screen = Gdk::Screen::get_default(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gchar *gtk_font_name = nullptr; gchar *gtkThemeName = nullptr; gchar *gtkIconThemeName = nullptr; Glib::ustring themeiconname; @@ -584,7 +583,7 @@ void Application::add_gtk_css() } else { prefs->setString("/theme/iconTheme", Glib::ustring(gtkIconThemeName)); } - g_object_get(settings, "gtk-font-name", >k_font_name, NULL); + } g_free(gtkThemeName); @@ -601,6 +600,26 @@ void Application::add_gtk_css() } Gtk::StyleContext::add_provider_for_screen(screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } + + Glib::ustring gtkthemename = prefs->getString("/theme/gtkTheme"); + gtkthemename += ".css"; + style = get_filename(UIS, gtkthemename.c_str()); + if (!style.empty()) { + if (themeprovider) { + Gtk::StyleContext::remove_provider_for_screen(screen, themeprovider); + } + if (!themeprovider) { + themeprovider = Gtk::CssProvider::create(); + } + try { + themeprovider->load_from_path(style); + } catch (const Gtk::CssProviderError &ex) { + g_critical("CSSProviderError::load_from_path(): failed to load '%s'\n(%s)", style.c_str(), + ex.what().c_str()); + } + Gtk::StyleContext::add_provider_for_screen(screen, themeprovider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } + if (!colorizeprovider) { colorizeprovider = Gtk::CssProvider::create(); } @@ -614,26 +633,6 @@ void Application::add_gtk_css() g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), ex.what().c_str()); } Gtk::StyleContext::add_provider_for_screen(screen, colorizeprovider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - - if (gtk_font_name && !strncmp(gtk_font_name, "Cantarell", 9)) { - auto provider = Gtk::CssProvider::create(); - css_str = "#monoStrokeWidth,"; - css_str += "#fillEmptySpace,"; - css_str += "#SelectStatus,"; - css_str += "#CoordinateStatusX,"; - css_str += "#CoordinateStatusY,"; - css_str += "#DesktopMainTable spinbutton{"; - css_str += " font-family: sans-serif;"; - css_str += "}"; // we also can add to * but seems to me Cantarell looks better for other places - try { - provider->load_from_data(css_str); - } catch (const Gtk::CssProviderError &ex) { - g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), - ex.what().c_str()); - } - Gtk::StyleContext::add_provider_for_screen(screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } - g_free(gtk_font_name); } void Application::readStyleSheets(bool forceupd) diff --git a/src/inkscape.h b/src/inkscape.h index 897f9e2963033523f7717452d746ea281de8370f..2ee35651a2145c0b23305b1664226c767a95f9c0 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -109,6 +109,7 @@ public: Inkscape::UI::Tools::ToolBase * active_event_context(); SPDocument * active_document(); SPDesktop * active_desktop(); + Glib::RefPtr themeprovider; Glib::RefPtr colorizeprovider; // Use this function to get selection model etc for a document Inkscape::ActionContext action_context_for_document(SPDocument *doc);