-
Notifications
You must be signed in to change notification settings - Fork 91
fix(ui): apply custom slider style method to theme and apply it to sliders #594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: switch-to-iced_layershell
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| use crate::config::{Appearance, AppearanceColor, AppearanceStyle, MenuAppearance, Position}; | ||
| use iced::{ | ||
| Background, Border, Color, Theme, | ||
| theme::{Palette, palette}, | ||
| theme::{palette, Palette}, | ||
| widget::{ | ||
| button::{self, Status}, | ||
| slider::{self, Status as SliderStatus}, | ||
| text_input::{self}, | ||
| }, | ||
| Background, Border, Color, Theme, | ||
| }; | ||
|
|
||
| #[allow(unused)] | ||
|
|
@@ -670,6 +671,29 @@ impl AshellTheme { | |
| } | ||
| } | ||
| } | ||
|
|
||
| pub fn slider_style(&self) -> fn(&Theme, SliderStatus) -> slider::Style { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having a function with the closure feels a bit weird since the code / theme is in the end static
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the branch was meant as a playground or collection of findings for @MalpenZibo because he is trying to sort things out (visuals). I am in no way gifted for pixel alignment of components. |
||
| |theme: &Theme, _status: SliderStatus| { | ||
| let palette = theme.extended_palette(); | ||
|
|
||
| slider::Style { | ||
| rail: slider::Rail { | ||
| backgrounds: ( | ||
| Background::Color(palette.primary.base.color), | ||
| Background::Color(palette.secondary.base.color), | ||
| ), | ||
| width: 4.0, | ||
| border: Border::default(), | ||
| }, | ||
| handle: slider::Handle { | ||
| shape: slider::HandleShape::Circle { radius: 7.0 }, | ||
| background: Background::Color(palette.primary.base.color), | ||
| border_width: 0.0, | ||
| border_color: palette.background.base.color, | ||
| }, | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| pub fn backdrop_color(backdrop: f32) -> Color { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the reorder? Trusting clippy/cargo fmt