Darken the desktop app theme (#86)
This commit is contained in:
@@ -939,11 +939,37 @@ fn main() -> iced::Result {
|
|||||||
iced::application(App::new, App::update, App::view)
|
iced::application(App::new, App::update, App::view)
|
||||||
.title(ironstorage::PRODUCT_NAME)
|
.title(ironstorage::PRODUCT_NAME)
|
||||||
.subscription(App::subscription)
|
.subscription(App::subscription)
|
||||||
|
.theme(app_theme)
|
||||||
.exit_on_close_request(false)
|
.exit_on_close_request(false)
|
||||||
.window(window_settings())
|
.window(window_settings())
|
||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const APP_BACKGROUND: Color = Color::from_rgb8(0x18, 0x18, 0x18);
|
||||||
|
const SURFACE_BACKGROUND: Color = Color::from_rgb8(0x20, 0x20, 0x20);
|
||||||
|
const HOVER_BACKGROUND: Color = Color::from_rgb8(0x2A, 0x2A, 0x2A);
|
||||||
|
const BORDER_COLOR: Color = Color::from_rgb8(0x3A, 0x3A, 0x3A);
|
||||||
|
const FOCUS_COLOR: Color = Color::from_rgb8(0x00, 0x7F, 0xD4);
|
||||||
|
const TEXT_COLOR: Color = Color::from_rgb8(0xD0, 0xD0, 0xD0);
|
||||||
|
const PRIMARY_COLOR: Color = Color::from_rgb8(0x0E, 0x63, 0x9C);
|
||||||
|
const SUCCESS_COLOR: Color = Color::from_rgb8(0x2E, 0x7D, 0x32);
|
||||||
|
const WARNING_COLOR: Color = Color::from_rgb8(0xC9, 0x8A, 0x20);
|
||||||
|
const DANGER_COLOR: Color = Color::from_rgb8(0xB6, 0x23, 0x24);
|
||||||
|
|
||||||
|
fn app_theme(_app: &App) -> Theme {
|
||||||
|
Theme::custom(
|
||||||
|
"IronStorage".to_owned(),
|
||||||
|
iced::theme::Palette {
|
||||||
|
background: APP_BACKGROUND,
|
||||||
|
text: TEXT_COLOR,
|
||||||
|
primary: PRIMARY_COLOR,
|
||||||
|
success: SUCCESS_COLOR,
|
||||||
|
warning: WARNING_COLOR,
|
||||||
|
danger: DANGER_COLOR,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn window_settings() -> window::Settings {
|
fn window_settings() -> window::Settings {
|
||||||
window::Settings {
|
window::Settings {
|
||||||
size: Size::new(960.0, 680.0),
|
size: Size::new(960.0, 680.0),
|
||||||
@@ -3971,14 +3997,14 @@ fn icon_control(icon: Icon, hint: String, message: Message) -> Element<'static,
|
|||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
const ENTRY_AREA_BACKGROUND: Color = Color::from_rgb8(18, 18, 20);
|
const ENTRY_AREA_BACKGROUND: Color = APP_BACKGROUND;
|
||||||
const ENTRY_FIELD_BACKGROUND: Color = Color::from_rgb8(24, 24, 27);
|
const ENTRY_FIELD_BACKGROUND: Color = SURFACE_BACKGROUND;
|
||||||
const ENTRY_FIELD_ACTIVE_BACKGROUND: Color = Color::from_rgb8(47, 47, 52);
|
const ENTRY_FIELD_ACTIVE_BACKGROUND: Color = HOVER_BACKGROUND;
|
||||||
const ENTRY_INPUT_BACKGROUND: Color = Color::from_rgb8(12, 12, 14);
|
const ENTRY_INPUT_BACKGROUND: Color = APP_BACKGROUND;
|
||||||
const ENTRY_TEXT: Color = Color::from_rgb8(235, 235, 238);
|
const ENTRY_TEXT: Color = Color::from_rgb8(0xE4, 0xE4, 0xE4);
|
||||||
const ENTRY_MUTED_TEXT: Color = Color::from_rgb8(165, 165, 172);
|
const ENTRY_MUTED_TEXT: Color = Color::from_rgb8(0x7D, 0x7D, 0x7D);
|
||||||
const ENTRY_BORDER: Color = Color::from_rgb8(72, 72, 78);
|
const ENTRY_BORDER: Color = BORDER_COLOR;
|
||||||
const ENTRY_FOCUSED_BORDER: Color = Color::from_rgb8(145, 145, 152);
|
const ENTRY_FOCUSED_BORDER: Color = FOCUS_COLOR;
|
||||||
const ENTRY_LABEL_WIDTH: f32 = 128.0;
|
const ENTRY_LABEL_WIDTH: f32 = 128.0;
|
||||||
|
|
||||||
fn entry_icon_control(icon: Icon, hint: String, message: Message) -> Element<'static, Message> {
|
fn entry_icon_control(icon: Icon, hint: String, message: Message) -> Element<'static, Message> {
|
||||||
@@ -6220,9 +6246,22 @@ mod tests {
|
|||||||
let _view = app.view();
|
let _view = app.view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn application_uses_the_deep_dark_palette() {
|
||||||
|
let app = test_app(None);
|
||||||
|
let theme = app_theme(&app);
|
||||||
|
assert_eq!(theme.palette().background, APP_BACKGROUND);
|
||||||
|
assert_eq!(APP_BACKGROUND, Color::from_rgb8(0x18, 0x18, 0x18));
|
||||||
|
assert_eq!(ENTRY_FIELD_BACKGROUND, SURFACE_BACKGROUND);
|
||||||
|
assert_eq!(ENTRY_FIELD_ACTIVE_BACKGROUND, HOVER_BACKGROUND);
|
||||||
|
assert_eq!(ENTRY_INPUT_BACKGROUND, APP_BACKGROUND);
|
||||||
|
assert_ne!(theme.palette().primary, theme.palette().danger);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn utility_panels_share_the_compact_entry_palette() {
|
fn utility_panels_share_the_compact_entry_palette() {
|
||||||
let theme = Theme::Dark;
|
let app = test_app(None);
|
||||||
|
let theme = app_theme(&app);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
entry_area_style(&theme).background,
|
entry_area_style(&theme).background,
|
||||||
Some(Background::Color(ENTRY_AREA_BACKGROUND))
|
Some(Background::Color(ENTRY_AREA_BACKGROUND))
|
||||||
|
|||||||
Reference in New Issue
Block a user