Update libcosmic
This commit is contained in:
parent
e788c175ec
commit
31a8427e10
4 changed files with 19 additions and 18 deletions
|
|
@ -15,9 +15,9 @@ log = "0.4"
|
|||
|
||||
[dependencies.libcosmic]
|
||||
git = "https://github.com/pop-os/libcosmic"
|
||||
rev = "2dde95ee"
|
||||
rev = "24709e9c3b56c49a0af168d1e37ebef85f112c8a"
|
||||
default-features = false
|
||||
features = ["wgpu", "winit"]
|
||||
features = ["winit_softbuffer"]
|
||||
#path = "../../../libcosmic"
|
||||
|
||||
[dependencies.rfd]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use cosmic::{
|
|||
Alignment, Application, Color, Command, Length,
|
||||
},
|
||||
settings,
|
||||
theme::{self, Theme},
|
||||
theme::{self, Theme, ThemeType},
|
||||
widget::{button, toggler},
|
||||
Element,
|
||||
};
|
||||
|
|
@ -154,7 +154,7 @@ impl Application for Window {
|
|||
update_attrs(&mut editor, attrs);
|
||||
|
||||
let mut window = Window {
|
||||
theme: Theme::Dark,
|
||||
theme: Theme::dark(),
|
||||
font_size: FontSize::Body,
|
||||
path_opt: None,
|
||||
attrs,
|
||||
|
|
@ -261,12 +261,12 @@ impl Application for Window {
|
|||
}
|
||||
Message::ThemeChanged(theme) => {
|
||||
self.theme = match theme {
|
||||
"Dark" => Theme::Dark,
|
||||
"Light" => Theme::Light,
|
||||
"Dark" => Theme::dark(),
|
||||
"Light" => Theme::light(),
|
||||
_ => return Command::none(),
|
||||
};
|
||||
|
||||
let Color { r, g, b, a } = self.theme.palette().text;
|
||||
let Color { r, g, b, a } = self.theme.cosmic().on_bg_color().into();
|
||||
let as_u8 = |component: f32| (component * 255.0) as u8;
|
||||
self.attrs = self.attrs.color(cosmic_text::Color::rgba(
|
||||
as_u8(r),
|
||||
|
|
@ -287,9 +287,10 @@ impl Application for Window {
|
|||
static THEMES: &[&str] = &["Dark", "Light"];
|
||||
let theme_picker = pick_list(
|
||||
THEMES,
|
||||
Some(match self.theme {
|
||||
Theme::Dark => THEMES[0],
|
||||
Theme::Light => THEMES[1],
|
||||
Some(match self.theme.theme_type {
|
||||
ThemeType::Dark => THEMES[0],
|
||||
ThemeType::Light => THEMES[1],
|
||||
_ => unreachable!(),
|
||||
}),
|
||||
Message::ThemeChanged,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use cosmic::{
|
|||
{Color, Element, Length, Point, Rectangle, Size},
|
||||
},
|
||||
iced_winit::renderer::BorderRadius,
|
||||
theme::Theme,
|
||||
theme::{Theme, ThemeType},
|
||||
};
|
||||
use cosmic_text::{Attrs, AttrsList, BufferLine, Metrics, SwashCache};
|
||||
use std::{cmp, sync::Mutex, time::Instant};
|
||||
|
|
@ -27,12 +27,12 @@ pub trait StyleSheet {
|
|||
|
||||
impl StyleSheet for Theme {
|
||||
fn appearance(&self) -> Appearance {
|
||||
match self {
|
||||
Theme::Dark => Appearance {
|
||||
match self.theme_type {
|
||||
ThemeType::Dark | ThemeType::HighContrastDark => Appearance {
|
||||
background_color: None,
|
||||
text_color: Color::from_rgb8(0xFF, 0xFF, 0xFF),
|
||||
},
|
||||
Theme::Light => Appearance {
|
||||
ThemeType::Light | ThemeType::HighContrastLight => Appearance {
|
||||
background_color: None,
|
||||
text_color: Color::from_rgb8(0x00, 0x00, 0x00),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use cosmic::{
|
|||
Padding, {Color, Element, Length, Point, Rectangle, Shell, Size},
|
||||
},
|
||||
iced_winit::renderer::BorderRadius,
|
||||
theme::Theme,
|
||||
theme::{Theme, ThemeType},
|
||||
};
|
||||
use cosmic_text::{Action, Edit, SwashCache};
|
||||
use std::{cmp, sync::Mutex, time::Instant};
|
||||
|
|
@ -32,12 +32,12 @@ pub trait StyleSheet {
|
|||
|
||||
impl StyleSheet for Theme {
|
||||
fn appearance(&self) -> Appearance {
|
||||
match self {
|
||||
Theme::Dark => Appearance {
|
||||
match self.theme_type {
|
||||
ThemeType::Dark | ThemeType::HighContrastDark => Appearance {
|
||||
background_color: Some(Color::from_rgb8(0x34, 0x34, 0x34)),
|
||||
text_color: Color::from_rgb8(0xFF, 0xFF, 0xFF),
|
||||
},
|
||||
Theme::Light => Appearance {
|
||||
ThemeType::Light | ThemeType::HighContrastLight => Appearance {
|
||||
background_color: Some(Color::from_rgb8(0xFC, 0xFC, 0xFC)),
|
||||
text_color: Color::from_rgb8(0x00, 0x00, 0x00),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue