From 9fffb093c36035529b71cae4ff2c07f353fdb331 Mon Sep 17 00:00:00 2001 From: Ralf Zerres Date: Mon, 20 Jul 2020 11:35:56 +0200 Subject: [PATCH] resources: stylesheets: switching to ron bases CSS * remove unused old theme.css files * advotracker.ron: new ron based theming style * main.rs: extend the dark theme with our stylesheet Signed-off-by: Ralf Zerres --- .../stylesheets/advotracker-dark.css | 52 ----- .../stylesheets/advotracker-light.css | 37 --- .../stylesheets/advotracker-test.css | 217 ------------------ .../resources/stylesheets/advotracker.css | 177 -------------- .../resources/stylesheets/advotracker.ron | 42 ++++ advotracker/resources/stylesheets/grid.css | 55 ----- .../stylesheets/policyholder-check.css | 53 ----- .../stylesheets/policyholder_check.css | 48 ---- advotracker/resources/stylesheets/theme.css | 91 -------- advotracker/src/main.rs | 34 +-- 10 files changed, 59 insertions(+), 747 deletions(-) delete mode 100644 advotracker/resources/stylesheets/advotracker-dark.css delete mode 100644 advotracker/resources/stylesheets/advotracker-light.css delete mode 100644 advotracker/resources/stylesheets/advotracker-test.css delete mode 100644 advotracker/resources/stylesheets/advotracker.css create mode 100644 advotracker/resources/stylesheets/advotracker.ron delete mode 100644 advotracker/resources/stylesheets/grid.css delete mode 100644 advotracker/resources/stylesheets/policyholder-check.css delete mode 100644 advotracker/resources/stylesheets/policyholder_check.css delete mode 100644 advotracker/resources/stylesheets/theme.css diff --git a/advotracker/resources/stylesheets/advotracker-dark.css b/advotracker/resources/stylesheets/advotracker-dark.css deleted file mode 100644 index 331c315..0000000 --- a/advotracker/resources/stylesheets/advotracker-dark.css +++ /dev/null @@ -1,52 +0,0 @@ -.header { - background: #444e55; -} - -.content { - background: #3b434a; -} - -text-box { - background: transparent; - border-width: 0; - color: #9dafbf; - font-size: 16; -} - -button.result_ok { - background: #008000; - color: #ffffff; - icon-color: ##008000; -} - -button.result_false { - background: #FF0000; - color: #ffffff; - icon-color: #FF0000; -} - -/* -button:active, button.result:active { - background: #516475; - color: #dfebf5; - icon-color: #dfebf5; -} -*/ - -#input { - font-size: 16; -} - -text-block { - font-size: 42; - color: #dfebf5; -} - -#input { - background: transparent; -} - -button { - border-radius: 1; - font-size: 20; -} diff --git a/advotracker/resources/stylesheets/advotracker-light.css b/advotracker/resources/stylesheets/advotracker-light.css deleted file mode 100644 index 7188a65..0000000 --- a/advotracker/resources/stylesheets/advotracker-light.css +++ /dev/null @@ -1,37 +0,0 @@ -* { - font-size: 16; -} - -.header { - background: #ffffff; -} - -.content { - background: #fafafa; -} - -.h1 { - font-size: 11; -} - -.seperator { - height: 32; - color: #ccdeed; - background: #3b434a; - border-color: #647b91; - border-width: 1; - border-radius: 3; - padding: 6; -} - -text-box { - color: #4d4c4c; -} - -text-block { - color: #4d4c4c; -} - -light-text { - color: #dfebf5; -} diff --git a/advotracker/resources/stylesheets/advotracker-test.css b/advotracker/resources/stylesheets/advotracker-test.css deleted file mode 100644 index 16b075a..0000000 --- a/advotracker/resources/stylesheets/advotracker-test.css +++ /dev/null @@ -1,217 +0,0 @@ -.my_header { - font-size: 24; -} - -/* defaults: dark.css -* { - background: #ffffff; - font-size: 16; - font-family: "Roboto Medium"; - icon-size: 16; - icon-family: "Material Icons"; -} - -window { - background: #ffffff; -} - -.h1 { - font-size: 36; -} -*/ - -/* -.top_bar { - padding-left: 4; - padding-right: 4; - min-height: 150; - background: #ffffff; - border-color: #5b0f22; -} - -.bottom_bar { - height: 40; - background: #ffffff; -} -*/ - -/* - font-family: "Roboto Medium"; - background: transparent; - border-width: 2; - border-color: #5b0f22; - border-radius: 2; - padding: 6; -} - -.text_form { - background: #ffffff; -} -.text_block { - background: #ffffff; - border-color: #5b0f22; - border-width: 0; - color: #5b0f22; -} - -text_box:empty { - color: #9E9E9E -} - -text_box:focus { - border-color: #f8de4c; -} - -/* -text_box.inplace { - color: #dfebf5; - background: transparent; - border-color: transparent; - border-width: 1; - border-radius: 2; - padding: 6; - font-size: 48; -} - -text_box.inplace:focus { - background: #ffffff; - border-color: #5b0f22; -} - -text_box.inplace:empty { - color: #9E9E9E -} - -.icon_only { - icon-color: transparent; - background: transparent; -} - -.icon_only:active { - icon-color: #5b0f22; - background: #5b0f22; -} - -.icon_only:disabled { - icon-color: transparent; - background: transparent; -} - -items-widget { - padding: 0; - border-color: transparent; - font-size: 48; -} - -list-view-item { - padding-left: 0; - padding-right: 0; - height: 62; -} - -list-view-item:active { - background: #ffffff; -} - -policy_check.text_box { - font-size: 48; -} - -policy_list.text_box { - font-size: 48; -} - -policy_list.text_box { - font-size: 48; -} - -.transparent { - icon-color: transparent; - background: transparent; -} - -.transparent:active { - icon-color: transparent; - background: transparent; -} - -.item_button { - background: transparent; - border-radius: 0; - font-size: 48; -} - -.separator { - background: #f8de4c; - color: #f8de4c; - border-width: 2; - border-color: #5b0f22; -} - */ - -/* - -const LINK_WATER_COLOR - color: #dfebf5; -const LYNCH_COLOR - color: #647b91; -const BOMBAY_COLOR - color: #adb3B8; -const SLATE_GRAY_COLOR - color: #6c7a90; -const BRIGHT_GRAY_COLOR - color: #3b434a; -const MATERIAL_RED_COLOR - color: #5b0f22; - -.header { - background: #ffffff; -} - -.content { - background: #fafafa; -} - -text-box { - color: #5b0f22; -} - -text-block { - color: #5b0f22; -} - -top-bar { - color: #5b0f22; - background: #fafafa; -} -*/ - -/* -light-text { - color: #dfebf5; -} -*/ - -/* // Hiedemann blue */ -/* color: #a5b3bf; */ - -/* // Hiedemann red */ -/* color: #5b0f22; */ - -/* // Hiedemann darkgrey */ -/* color: #879488; */ - -/* // Hiedemann grey */ -/* color: ##b6c3b7; */ - - - -/* // Qt Green */ -/* color: #41cd52; */ - -/* // lightgrey */ -/* color: #f0f0f0; */ - -/* Accent=#5b0f22 */ -/* Foreground=#000000 */ -/* Background=#f0f0f0 */ diff --git a/advotracker/resources/stylesheets/advotracker.css b/advotracker/resources/stylesheets/advotracker.css deleted file mode 100644 index 915e6a7..0000000 --- a/advotracker/resources/stylesheets/advotracker.css +++ /dev/null @@ -1,177 +0,0 @@ -* { - background: #fafafa; - font-size: 18; - font-family: "Roboto Medium"; - icon-size: 18; - icon-family: "Material Icons"; -} - -.bottom_bar { - height: 40; - background: #475b6e; -} - -.header { - background: #fafafa; - color: #475b6e; - font-size: 32; - font-family: "Roboto Medium"; - /* min-height: 52; */ - padding-left: 4; - padding-right: 4; -} - -.content { - background: #fafafa; - /* background: #3b434a; */ -} - -.check_form { - border-width: 1; - background: transparent; - padding: 9; -} - -.item_button { - background: transparent; - border-radius: 0; -} - -.menu_button { - /* background: #5b0f22; */ - background: transparent; - icon-color: #fafafa; - spacing: 0; -} - -.menu_button:active { - background: #5b0f22; - icon-color: #fafafa; - spacing: 0; -} - -.menu_button:disabled { - icon-color: #fffffff; - background: transparent; -} - -.separator { - background: #134343; -} - -.single_content { - background: transparent; - color: transparent; - icon-color: #fafafa; - spacing: 0; -} - -.single_content.active { - icon-color: #fafafa; - spacing: 0; -} - -.single_content.inactive { - background: transparent; - color: transparent; - icon-color: #fafafa; - spacing: 0; -} - -.single_content.disabled { - icon-color: #fafafa; - background: transparent; - spacing: 0; -} - -.single_button { - spacing: 0; - background: #3b434a; -} - -.transparent { - icon-color: transparent; - background: transparent; -} - -.transparent:active { - icon-color: transparent; - background: transparent; -} - -items-widget { - padding: 0; - border-color: transparent; -} - -/* -button { - border-radius: 3; - background: #5b0f22; - size: 8; - font-size: 12; -} -*/ - -/* -button.square { - border-radius: 10; -} -*/ - -button.result_ok { - background: #008000; - color: #ffffff; - icon-color: #008000; -} - -button.result_false { - background: #FF0000; - color: #ffffff; - icon-color: #FF0000; -} - -/* -button:active, button.result:active { - background: #516475; - color: #dfebf5; - icon-color: #dfebf5; -} - -#input { - font-size: 16; - background: transparent; -} -*/ - -text-block { - font-size: 42; - color: #dfebf5; -} - -text-box { - background: transparent; - border-width: 0; - color: #9dafbf; - font-size: 16; -} - -text_box.inplace { - color: #dfebf5; - background: transparent; - border-color: transparent; - border-width: 1; - border-radius: 2; - padding: 6; -} - -text_box.inplace:focus { - background: #3b434a; - border-color: #5b0f22; - /* border-color: #f8de4c; */ -} - -text_box.inplace:empty { - color: #9E9E9E; - border-color: #5b0f22; -} diff --git a/advotracker/resources/stylesheets/advotracker.ron b/advotracker/resources/stylesheets/advotracker.ron new file mode 100644 index 0000000..6c7e54b --- /dev/null +++ b/advotracker/resources/stylesheets/advotracker.ron @@ -0,0 +1,42 @@ +Theme ( + styles: { + "base": ( + properties: { + "font_size": "$FONT_SIZE_12", + "font_family": "$MEDIUM_FONT", + } + ), + "button": ( + base: "base", + properties: { + "background": "$BLACK", + }, + states: { + "pressed": { + "background": "$WHITE", + } + } + ), + "menu": ( + base: "base", + properties: { + "font_size": "$FONT_SIZE_10", + "font_family": "$MEDIUM_FONT", + "background": "$BLACK", + }, + states: { + "pressed": { + "background": "$WHITE", + } + } + ) + } + resource: { + "BLACK": "#000000", + "WHITE": "#ffffff", + "MEDIUM_FONT": "Roboto Medium", + "FONT_SIZE_10": 10, + "FONT_SIZE_12": 12, + "FONT_SIZE_16": 16, + } +) \ No newline at end of file diff --git a/advotracker/resources/stylesheets/grid.css b/advotracker/resources/stylesheets/grid.css deleted file mode 100644 index 92ec7e2..0000000 --- a/advotracker/resources/stylesheets/grid.css +++ /dev/null @@ -1,55 +0,0 @@ -* { - font-size: 16; -} - -lynch { - background: #647b91; -} - -bluebayoux { - background: #516475; -} - -linkwater { - background: #dfebf5; - color: #3b434a; -} - -light-text { - color: #dfebf5; -} - -goldendream { - background: #efd035; - color: #3b434a; -} - -lightgrey { - #f0f0f0; -} - -darkgrey { - #879488; -} - -grey { - #b6c3b7; -} - -Indigo-bases { - #5c6bc0; -} - -hiedemann-blue { - #a5b3bf; -} - -hiedemann-red { - color: #5b0f22; -} - -hiedemann { - background: #5b0f22; - color: #879488; - //color: #3b434a; -} diff --git a/advotracker/resources/stylesheets/policyholder-check.css b/advotracker/resources/stylesheets/policyholder-check.css deleted file mode 100644 index 4a9c766..0000000 --- a/advotracker/resources/stylesheets/policyholder-check.css +++ /dev/null @@ -1,53 +0,0 @@ -* { - font-size: 24; -} - -.header { - background: #ffffff; -} - -.background { - background: #fafafa; -} - -.content { - background: #fafafa; -} - -text-box { - color: #5b0f22; -} - -text-block { - color: #5b0f22; -} - -light-text { - color: #dfebf5; -} - - -/* // Hiedemann blue */ -/* color: #a5b3bf; */ -/* color: #4d4c4c; */ - -/* // Hiedemann red */ -/* color: #5b0f22; */ - -/* // Hiedemann darkgrey */ -/* color: #879488; */ - -/* // Hiedemann grey */ -/* color: ##b6c3b7; */ - - - -/* // Qt Green */ -/* color: #41cd52; */ - -/* // lightgrey */ -/* color: #f0f0f0; */ - -/* Accent=#5b0f22 */ -/* Foreground=#000000 */ -/* Background=#f0f0f0 */ diff --git a/advotracker/resources/stylesheets/policyholder_check.css b/advotracker/resources/stylesheets/policyholder_check.css deleted file mode 100644 index b989455..0000000 --- a/advotracker/resources/stylesheets/policyholder_check.css +++ /dev/null @@ -1,48 +0,0 @@ -.header { - background: #ffffff; -} - -.content { - background: #fafafa; -} -.content { - background: #fafafa; -} - -text-box { - color: #5b0f22; -} - -text-block { - color: #5b0f22; -} - -/* -light-text { - color: #dfebf5; -} -*/ - -/* // Hiedemann blue */ -/* color: #a5b3bf; */ - -/* // Hiedemann red */ -/* color: #5b0f22; */ - -/* // Hiedemann darkgrey */ -/* color: #879488; */ - -/* // Hiedemann grey */ -/* color: ##b6c3b7; */ - - - -/* // Qt Green */ -/* color: #41cd52; */ - -/* // lightgrey */ -/* color: #f0f0f0; */ - -/* Accent=#5b0f22 */ -/* Foreground=#000000 */ -/* Background=#f0f0f0 */ diff --git a/advotracker/resources/stylesheets/theme.css b/advotracker/resources/stylesheets/theme.css deleted file mode 100644 index c0cdd73..0000000 --- a/advotracker/resources/stylesheets/theme.css +++ /dev/null @@ -1,91 +0,0 @@ -.top_bar { - padding-left: 4; - padding-right: 4; - min-height: 52; - background: #475b6e; -} - -.bottom_bar { - height: 40; - background: #475b6e; -} - -.header { - font-size: 64; - font-family: "Roboto Medium"; -} - -text_box.inplace { - color: #dfebf5; - background: transparent; - border-color: transparent; - border-width: 1; - border-radius: 2; - padding: 6; - font-size: 48; -} - -text_box.inplace:focus { - background: #3b434a; - border-color: #f8de4c;; -} - -text_box.inplace:empty { - color: #9E9E9E -} - -.icon_only { - icon-color: #dfebf5; - background: transparent; - spacing: 0; -} - -.icon_only:active { - background: #516475; - icon-color: #dfebf5; -} - -.icon_only:disabled { - icon-color: #949ca5; - background: transparent; -} - -items-widget { - padding: 0; - border-color: transparent; - font-size: 48; -} - -list-view-item { - padding-left: 0; - padding-right: 0; - height: 62; -} - -list-view-item:active { - background: #516475; -} - -overview_view.text_box { - font-size: 48; -} - -.transparent { - icon-color: transparent; - background: transparent; -} - -.transparent:active { - icon-color: transparent; - background: transparent; -} - -.item_button { - background: transparent; - border-radius: 0; - font-size: 48; -} - -.separator { - background: #212121; -} diff --git a/advotracker/src/main.rs b/advotracker/src/main.rs index 5d19c08..407627d 100644 --- a/advotracker/src/main.rs +++ b/advotracker/src/main.rs @@ -13,17 +13,15 @@ //use chrono::{Local, DateTime}; use locales::t; -//use serde::{Deserialize, Serialize}; use serde::Deserialize; use std::env; -//use std::process; -//use std::{error::Error, process}; -//use std::collections::HashMap; use tracing::{debug, trace, Level}; -use orbtk::prelude::*; -use orbtk::theme::DEFAULT_THEME_CSS; -//use orbtk::theme::LIGHT_THEME_EXTENSION_CSS; +use orbtk::{ + prelude::*, + theme::{COLORS_RON, DARK_THEME_RON, FONTS_RON}, + theming::config::ThemeConfig, +}; // The Main view use advotracker::widgets::main_view; @@ -39,9 +37,6 @@ struct Environment { rust_log: String, } -//#[cfg(feature = "light-theme")] -static STYLESHEET: &'static str = include_str!("../resources/stylesheets/advotracker.css"); - // lazy_static! { // static ref LANG: String + 'static = { // let mut lang = env::var("LANG").unwrap_or("en".to_string()) @@ -60,11 +55,16 @@ static STYLESHEET: &'static str = include_str!("../resources/stylesheets/advotra // }; // } -fn get_theme() -> ThemeValue { - ThemeValue::create_from_css(DEFAULT_THEME_CSS) - //ThemeValue::create_from_css(LIGHT_THEME_EXTENSION_CSS) - .extension_css(STYLESHEET) - .build() +static DARK_EXT: &'static str = include_str!("../resources/stylesheets/advotracker_dark.ron"); + +fn theme() -> Theme { + Theme::from_config( + // sourcing: crates/theme/assets/dark/dark.ron + ThemeConfig::from(DARK_THEME_RON) + .extend(ThemeConfig::from(DARK_EXT)) + .extend(ThemeConfig::from(COLORS_RON)) + .extend(ThemeConfig::from(FONTS_RON)), + ) } fn main() -> Result<(), Box> { @@ -196,7 +196,8 @@ fn main() -> Result<(), Box> { //} Application::from_name("nwx.advotracker") - .window(move |ctx| { + .theme(theme()) + .window(|ctx| { Window::new() .title("AdvoTracker - DirectCall") .position((500.0, 100.0)) @@ -204,7 +205,6 @@ fn main() -> Result<(), Box> { .min_width(460.0) .min_height(180.0) .resizeable(true) - .theme(get_theme()) .child(main_view::MainView::new().build(ctx)) .build(ctx) })