You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
Is your feature request related to a problem? Please describe.
I am considering having beta releases along the stable releases for my app and would like to use the devel style class but it seems like the Window object does not expose a style method like other widgets.
Describe the solution you'd like
It would be nice to be able to add some custom styling through CSS to the various widgets. Maybe the style method could accept a CSS file/string? (per widget direct styling) or any other way of loading custom CSS through a provider (global styling - declare classes and attach them to widgets via a different call). Convention normally uses a file called style.css.
gtk-rs sample:
fnload_css(){// Load the CSS file and add it to the providerlet provider = CssProvider::new();
provider.load_from_string(include_str!("style.css"));// Add the provider to the default screen
gtk::style_context_add_provider_for_display(&Display::default().expect("Could not connect to a display."),&provider,
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,);}
....
let button = gtk::Button::with_label("hover me!");
button.add_css_class("button1");// declared in style.csslet entry = gtk::Entry::new();
entry.add_css_class("entry1");// declared in style.css
Specifically for my use case, I would like to style the Buttons in order to specify a custom icon size via -gtk-icon-size CSS property. Something like:
Devel window: You can use the new devel(_:) modifier.
Custom CSS: Apply bits of CSS to a view that will be loaded once the view appears for the first time with the css(_:) modifier (it's then globally available and can be used with style(_:active:)). It's your choice whether to write the CSS directly as a string, read from a CSS file or use some kind of Swift CSS DSL. An example:
Button(label){
number =.random(in:1...6)}.pill().suggested().style("custom-button").css{""" .custom-button { background-color: @green_5; }"""}
Is your feature request related to a problem? Please describe.
I am considering having beta releases along the stable releases for my app and would like to use the
devel
style class but it seems like the Window object does not expose a style method like other widgets.Describe the solution you'd like
It would be nice to be able to add some custom styling through CSS to the various widgets. Maybe the
style
method could accept a CSS file/string? (per widget direct styling) or any other way of loading custom CSS through a provider (global styling - declare classes and attach them to widgets via a different call). Convention normally uses a file calledstyle.css
.gtk-rs sample:
Specifically for my use case, I would like to style the Buttons in order to specify a custom icon size via
-gtk-icon-size
CSS property. Something like:Describe alternatives you've considered
For now as a workaround I am using a different widget (not a button) that allows custom sizing, but ideally we would be able to use custom CSS.
Additional context
References:
The text was updated successfully, but these errors were encountered: