Skip to content

Commit 4ebe118

Browse files
authored
Merge pull request #82 from FreddyFunk/bugfix/improve-resolution-and-framerate-picker-UI-when-using-light-theme
improve resolution and framrate picker UI when using light theme mode
2 parents 87d32a3 + 0e0532b commit 4ebe118

3 files changed

Lines changed: 23 additions & 19 deletions

File tree

src/app/camera_preview/widget.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::app::state::{AppModel, Message};
66
use crate::app::video_widget::{self, VideoContentFit};
77
use crate::fl;
88
use cosmic::Element;
9-
use cosmic::iced::{Background, Color, Length};
9+
use cosmic::iced::{Background, Length};
1010
use cosmic::widget;
1111
use tracing::info;
1212

@@ -30,9 +30,9 @@ impl AppModel {
3030
.height(Length::Fill)
3131
.align_x(cosmic::iced::alignment::Horizontal::Center)
3232
.align_y(cosmic::iced::alignment::Vertical::Center)
33-
.style(|_theme| widget::container::Style {
34-
background: Some(Background::Color(Color::BLACK)),
35-
text_color: Some(Color::WHITE),
33+
.style(|theme| widget::container::Style {
34+
background: Some(Background::Color(theme.cosmic().bg_color().into())),
35+
text_color: Some(theme.cosmic().on_bg_color().into()),
3636
..Default::default()
3737
})
3838
.into();
@@ -102,12 +102,12 @@ impl AppModel {
102102
info!(render_count = count, "No frame available in view");
103103
}
104104

105-
// Black canvas placeholder when no camera frame
105+
// Themed canvas placeholder when no camera frame
106106
widget::container(widget::Space::new(Length::Fill, Length::Fill))
107107
.width(Length::Fill)
108108
.height(Length::Fill)
109-
.style(|_theme| widget::container::Style {
110-
background: Some(Background::Color(Color::BLACK)),
109+
.style(|theme: &cosmic::Theme| widget::container::Style {
110+
background: Some(Background::Color(theme.cosmic().bg_color().into())),
111111
..Default::default()
112112
})
113113
.into()

src/app/format_picker/view.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,25 @@ impl AppModel {
113113
}
114114
}
115115

116-
// Build picker panel with semi-transparent background
116+
// Build picker panel with semi-transparent themed background
117117
let picker_panel = widget::container(
118118
widget::column()
119119
.push(res_row)
120120
.push(widget::vertical_space().height(spacing.space_s))
121121
.push(fps_row)
122122
.padding(spacing.space_xs),
123123
)
124-
.style(|_theme| widget::container::Style {
125-
background: Some(Background::Color(Color::from_rgba(0.0, 0.0, 0.0, 0.4))),
126-
border: Border {
127-
radius: [ui::PICKER_BORDER_RADIUS; 4].into(),
124+
.style(|theme: &cosmic::Theme| {
125+
let mut bg: Color = theme.cosmic().bg_color().into();
126+
bg.a = 0.85; // Semi-transparent
127+
widget::container::Style {
128+
background: Some(Background::Color(bg)),
129+
border: Border {
130+
radius: [ui::PICKER_BORDER_RADIUS; 4].into(),
131+
..Default::default()
132+
},
128133
..Default::default()
129-
},
130-
..Default::default()
134+
}
131135
});
132136

133137
// Position picker and add click-outside-to-close

src/app/view.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ impl AppModel {
5656
)
5757
.width(Length::Fill)
5858
.height(Length::Fill)
59-
.style(|_theme| widget::container::Style {
60-
background: Some(Background::Color(Color::BLACK)),
59+
.style(|theme| widget::container::Style {
60+
background: Some(Background::Color(theme.cosmic().bg_color().into())),
6161
..Default::default()
6262
})
6363
.into();
@@ -271,12 +271,12 @@ impl AppModel {
271271
main_stack = main_stack.push(self.build_format_picker());
272272
}
273273

274-
// Wrap everything in a black background container
274+
// Wrap everything in a themed background container
275275
widget::container(main_stack)
276276
.width(Length::Fill)
277277
.height(Length::Fill)
278-
.style(|_theme| widget::container::Style {
279-
background: Some(Background::Color(Color::BLACK)),
278+
.style(|theme| widget::container::Style {
279+
background: Some(Background::Color(theme.cosmic().bg_color().into())),
280280
..Default::default()
281281
})
282282
.into()

0 commit comments

Comments
 (0)