Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/modules/media_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ impl MediaPlayer {
slider(0.0..=100.0, v, move |v| {
Message::SetVolume(d.service.clone(), v)
})
.style(theme.slider_style())
.width(LEFT_COLUMN_WIDTH)
.into()
});
Expand Down
1 change: 1 addition & 0 deletions src/modules/settings/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ impl AudioSettings {
volume.value(),
remote_value::Message::Request,
)
.style(theme.slider_style())
.on_release(remote_value::Message::Timeout),
)
.map(volume_changed),
Expand Down
1 change: 1 addition & 0 deletions src/modules/settings/brightness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl BrightnessSettings {
service.current.value(),
remote_value::Message::Request,
)
.style(theme.slider_style())
.on_release(remote_value::Message::Timeout),
)
.map(Message::Changed)
Expand Down
28 changes: 26 additions & 2 deletions src/theme.rs
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,
Copy link
Copy Markdown
Collaborator

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

};

#[allow(unused)]
Expand Down Expand Up @@ -670,6 +671,29 @@ impl AshellTheme {
}
}
}

pub fn slider_style(&self) -> fn(&Theme, SliderStatus) -> slider::Style {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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
Dont know if there is a cleaner way and pretty sure the compiler would inline this anyways
So just thinking here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The 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 {
Expand Down
Loading