From 7dde19a39cf07a86a1e7a735ebb49cb3c8ab10e8 Mon Sep 17 00:00:00 2001 From: MoAlyousef Date: Sat, 25 Sep 2021 22:18:47 +0300 Subject: [PATCH] add prelim aqua_dark and aqua_light --- Cargo.toml | 2 - examples/aqua2.rs | 18 - examples/aqua_dark.rs | 14 + examples/frames.rs | 4 +- examples/widget_theme.rs | 6 +- src/lib.rs | 15 +- .../{aqua.rs => aqua_classic.rs} | 92 +-- src/widget_themes/aqua_dark.rs | 535 ++++++++++++++++++ src/widget_themes/{aqua2.rs => aqua_light.rs} | 172 ++++-- src/widget_themes/mod.rs | 6 +- 10 files changed, 730 insertions(+), 134 deletions(-) delete mode 100644 examples/aqua2.rs create mode 100644 examples/aqua_dark.rs rename src/widget_themes/{aqua.rs => aqua_classic.rs} (80%) create mode 100644 src/widget_themes/aqua_dark.rs rename src/widget_themes/{aqua2.rs => aqua_light.rs} (73%) diff --git a/Cargo.toml b/Cargo.toml index f5790bb..7ffc522 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,6 @@ exclude = ["/screenshots", "./examples"] [dependencies] fltk = "1.1.6" - -[target.'cfg(target_os = "macos")'.dependencies] lazy_static = "1.4" [target.'cfg(target_os = "macos")'.build-dependencies] diff --git a/examples/aqua2.rs b/examples/aqua2.rs deleted file mode 100644 index b0041fe..0000000 --- a/examples/aqua2.rs +++ /dev/null @@ -1,18 +0,0 @@ -#[cfg(target_os = "macos")] -fn main() { - use fltk::{prelude::*, *}; - use fltk_theme::{widget_themes, WidgetTheme, ThemeType}; - - let a = app::App::default(); - let widget_theme = WidgetTheme::new(ThemeType::Aqua2); - widget_theme.apply(); - let mut win = window::Window::default().with_size(400, 300); - let mut btn = button::Button::new(160, 200, 80, 30, "Hello"); - btn.set_frame(widget_themes::OS_DEFAULT_BUTTON_UP_BOX); - win.end(); - win.show(); - a.run().unwrap(); -} - -#[cfg(not(target_os = "macos"))] -fn main() {} \ No newline at end of file diff --git a/examples/aqua_dark.rs b/examples/aqua_dark.rs new file mode 100644 index 0000000..b2e1347 --- /dev/null +++ b/examples/aqua_dark.rs @@ -0,0 +1,14 @@ +use fltk::{prelude::*, *}; +use fltk_theme::{widget_themes, WidgetTheme, ThemeType}; + +fn main() { + let a = app::App::default(); + let widget_theme = WidgetTheme::new(ThemeType::AquaLight); + widget_theme.apply(); + let mut win = window::Window::default().with_size(400, 300); + let mut btn = button::Button::new(160, 200, 80, 30, "Hello"); + // btn.set_frame(widget_themes::OS_DEFAULT_BUTTON_UP_BOX); + win.end(); + win.show(); + a.run().unwrap(); +} diff --git a/examples/frames.rs b/examples/frames.rs index 2706e98..039668f 100644 --- a/examples/frames.rs +++ b/examples/frames.rs @@ -7,7 +7,7 @@ fn main() { theme.apply(); let mut win = window::Window::default().with_size(800, 800); let mut choice = menu::Choice::new(300, 10, 200, 30, None); - choice.add_choice("Classic|Aero|Metro|Aqua|Greybird|Blue|HighContrast|Dark|Fluent"); + choice.add_choice("Classic|Aero|Metro|AquaClassic|Greybird|Blue|HighContrast|Dark|Fluent"); choice.set_value(6); choice.set_frame(OS_PANEL_THIN_UP_BOX); let mut vgrid = group::VGrid::new(50, 100, 700, 700, None); @@ -105,7 +105,7 @@ fn main() { 0 => WidgetTheme::new(ThemeType::Classic), 1 => WidgetTheme::new(ThemeType::Aero), 2 => WidgetTheme::new(ThemeType::Metro), - 3 => WidgetTheme::new(ThemeType::Aqua), + 3 => WidgetTheme::new(ThemeType::AquaClassic), 4 => WidgetTheme::new(ThemeType::Greybird), 5 => WidgetTheme::new(ThemeType::Blue), 6 => WidgetTheme::new(ThemeType::HighContrast), diff --git a/examples/widget_theme.rs b/examples/widget_theme.rs index 18660ab..8a85dc2 100644 --- a/examples/widget_theme.rs +++ b/examples/widget_theme.rs @@ -3,11 +3,11 @@ use fltk_theme::{widget_themes, ThemeType, WidgetTheme}; fn main() { let a = app::App::default(); - let theme = WidgetTheme::new(ThemeType::Aqua); + let theme = WidgetTheme::new(ThemeType::AquaClassic); theme.apply(); let mut win = window::Window::default().with_size(400, 300); let mut choice = menu::Choice::new(100, 100, 200, 30, None); - choice.add_choice("Classic|Aero|Metro|Aqua|Greybird|Blue|HighContrast|Dark|Fluent"); + choice.add_choice("Classic|Aero|Metro|AquaClassic|Greybird|Blue|HighContrast|Dark|Fluent"); choice.set_value(3); choice.set_frame(widget_themes::OS_PANEL_THIN_UP_BOX); let mut check = button::CheckButton::new(160, 150, 80, 30, " Check"); @@ -25,7 +25,7 @@ fn main() { 0 => WidgetTheme::new(ThemeType::Classic), 1 => WidgetTheme::new(ThemeType::Aero), 2 => WidgetTheme::new(ThemeType::Metro), - 3 => WidgetTheme::new(ThemeType::Aqua), + 3 => WidgetTheme::new(ThemeType::AquaClassic), 4 => WidgetTheme::new(ThemeType::Greybird), 5 => WidgetTheme::new(ThemeType::Blue), 6 => WidgetTheme::new(ThemeType::HighContrast), diff --git a/src/lib.rs b/src/lib.rs index 76b3db4..8316a63 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -132,10 +132,11 @@ pub enum ThemeType { /// Windows 8 Metro, /// Classic MacOS - Aqua, - #[cfg(target_os = "macos")] - /// Modern MacOS using system colors, supports Dark theme - Aqua2, + AquaClassic, + /// Modern MacOS using system colors, Dark theme + AquaDark, + /// Modern MacOS using system colors, light theme + AquaLight, /// Xfce Greybird, /// Windows 2000 @@ -164,9 +165,9 @@ impl WidgetTheme { match self.theme { ThemeType::Classic => widget_themes::classic::use_classic_theme(), ThemeType::Aero => widget_themes::aero::use_aero_theme(), - ThemeType::Aqua => widget_themes::aqua::use_aqua_theme(), - #[cfg(target_os = "macos")] - ThemeType::Aqua2 => widget_themes::aqua2::use_aqua2_theme(), + ThemeType::AquaClassic => widget_themes::aqua_classic::use_aqua_classic_theme(), + ThemeType::AquaDark => widget_themes::aqua_dark::use_aqua_dark_theme(), + ThemeType::AquaLight => widget_themes::aqua_light::use_aqua_light_theme(), ThemeType::Dark => widget_themes::dark::use_dark_theme(), ThemeType::HighContrast => widget_themes::high_contrast::use_high_contrast_theme(), ThemeType::Blue => widget_themes::blue::use_blue_theme(), diff --git a/src/widget_themes/aqua.rs b/src/widget_themes/aqua_classic.rs similarity index 80% rename from src/widget_themes/aqua.rs rename to src/widget_themes/aqua_classic.rs index cb47d63..e3249d9 100644 --- a/src/widget_themes/aqua.rs +++ b/src/widget_themes/aqua_classic.rs @@ -1,7 +1,7 @@ use super::*; use fltk::{app, enums::Color, misc::Tooltip}; -fn aqua_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0x9A, 0x9A, 0x9A))); draw_xyline(x + 3, y, x + w - 4); @@ -34,7 +34,7 @@ fn aqua_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); } -fn aqua_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { if w >= h { // top gradient vertical_gradient( @@ -68,21 +68,21 @@ fn aqua_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); draw_yxline(x + w - 3, y + 2, y + h - 3); } - aqua_button_up_frame(x, y, w, h, c); + aqua_classic_button_up_frame(x, y, w, h, c); } -fn aqua_panel_thin_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_panel_thin_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(devalued(c, 0.06751))); draw_rect(x, y, w, h); } -fn aqua_panel_thin_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_panel_thin_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(c)); draw_rectf(x + 1, y + 1, w - 2, h - 2); - aqua_panel_thin_up_frame(x, y, w, h, c); + aqua_classic_panel_thin_up_frame(x, y, w, h, c); } -fn aqua_spacer_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_spacer_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top and left borders set_draw_color(activated_color(Color::from_rgb(0xD6, 0xD6, 0xD6))); draw_yxline2(x, y + h - 2, y, x + w - 2); @@ -91,18 +91,18 @@ fn aqua_spacer_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_xyline2(x, y + h - 1, x + w - 1, y); } -fn aqua_spacer_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_spacer_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(c)); draw_rectf(x + 1, y + 1, w - 2, h - 2); - aqua_spacer_thin_down_frame(x, y, w, h, c); + aqua_classic_spacer_thin_down_frame(x, y, w, h, c); } -fn aqua_radio_round_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_radio_round_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(devalued(c, 0.42194))); draw_arc(x, y, w, h, 0.0, 360.0); } -fn aqua_radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { // top edges set_draw_color(activated_color(Color::from_rgb(0xF6, 0xF6, 0xF6))); draw_arc(x + 1, y + 1, w - 2, h - 2, 0.0, 180.0); @@ -124,10 +124,10 @@ fn aqua_radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { // bottom gradient set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); draw_xyline(x + 2, y + h - 3, x + w - 3); - aqua_radio_round_down_frame(x, y, w, h, c); + aqua_classic_radio_round_down_frame(x, y, w, h, c); } -fn aqua_depressed_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_depressed_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0x4C, 0x54, 0xAA))); draw_xyline(x + 3, y, x + w - 4); @@ -159,7 +159,7 @@ fn aqua_depressed_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); } -fn aqua_depressed_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_depressed_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { // top gradient vertical_gradient( x + 2, @@ -178,10 +178,10 @@ fn aqua_depressed_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { Color::from_rgb(0x46, 0x93, 0xE9), Color::from_rgb(0xAA, 0xD4, 0xF0), ); - aqua_depressed_down_frame(x, y, w, h, c); + aqua_classic_depressed_down_frame(x, y, w, h, c); } -fn aqua_input_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_input_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0x9B, 0x9B, 0x9B))); draw_xyline(x, y, x + w - 1); @@ -196,13 +196,13 @@ fn aqua_input_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_yxline3(x + 1, y + h - 2, y + 2, x + w - 2, y + h - 2); } -fn aqua_input_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_input_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(Color::from_rgb(0xFF, 0xFF, 0xFF))); draw_rectf(x + 2, y + 3, w - 4, h - 4); - aqua_input_thin_down_frame(x, y, w, h, c); + aqua_classic_input_thin_down_frame(x, y, w, h, c); } -fn aqua_default_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_default_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0x4E, 0x59, 0xA6))); draw_xyline(x + 3, y, x + w - 4); @@ -234,7 +234,7 @@ fn aqua_default_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); } -fn aqua_default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { // top gradient vertical_gradient( x + 2, @@ -253,10 +253,10 @@ fn aqua_default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { Color::from_rgb(0x59, 0xB5, 0xF1), Color::from_rgb(0xBA, 0xE9, 0xF7), ); - aqua_default_button_up_frame(x, y, w, h, c); + aqua_classic_default_button_up_frame(x, y, w, h, c); } -fn aqua_tabs_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_tabs_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0xAE, 0xAE, 0xAE))); draw_xyline(x + 3, y, x + w - 4); @@ -287,13 +287,13 @@ fn aqua_tabs_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); } -fn aqua_tabs_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_tabs_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(c)); draw_rectf(x + 2, y + 2, w - 4, h - 4); - aqua_tabs_frame(x, y, w, h, c); + aqua_classic_tabs_frame(x, y, w, h, c); } -fn aqua_swatch_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_swatch_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // outer border set_draw_color(activated_color(Color::from_rgb(0xA3, 0xA3, 0xA3))); draw_rect(x, y, w, h); @@ -302,31 +302,31 @@ fn aqua_swatch_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_rect(x + 1, y + 1, w - 2, h - 2); } -fn aqua_swatch_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_classic_swatch_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(c)); draw_rectf(x + 2, y + 2, w - 4, h - 4); - aqua_swatch_frame(x, y, w, h, c); + aqua_classic_swatch_frame(x, y, w, h, c); } -fn use_aqua_scheme() { +fn use_aqua_classic_scheme() { app::set_scheme(app::Scheme::Gtk); - app::set_frame_type_cb(OS_BUTTON_UP_BOX, aqua_button_up_box, 1, 1, 2, 2); + app::set_frame_type_cb(OS_BUTTON_UP_BOX, aqua_classic_button_up_box, 1, 1, 2, 2); app::set_frame_type2(OS_CHECK_DOWN_BOX, OS_BUTTON_UP_BOX); - app::set_frame_type_cb(OS_BUTTON_UP_FRAME, aqua_button_up_frame, 1, 1, 2, 2); + app::set_frame_type_cb(OS_BUTTON_UP_FRAME, aqua_classic_button_up_frame, 1, 1, 2, 2); app::set_frame_type2(OS_CHECK_DOWN_FRAME, OS_BUTTON_UP_FRAME); - app::set_frame_type_cb(OS_PANEL_THIN_UP_BOX, aqua_panel_thin_up_box, 1, 1, 2, 2); + app::set_frame_type_cb(OS_PANEL_THIN_UP_BOX, aqua_classic_panel_thin_up_box, 1, 1, 2, 2); app::set_frame_type_cb( OS_SPACER_THIN_DOWN_BOX, - aqua_spacer_thin_down_box, + aqua_classic_spacer_thin_down_box, 1, 1, 2, 2, ); - app::set_frame_type_cb(OS_PANEL_THIN_UP_FRAME, aqua_panel_thin_up_frame, 1, 1, 2, 2); + app::set_frame_type_cb(OS_PANEL_THIN_UP_FRAME, aqua_classic_panel_thin_up_frame, 1, 1, 2, 2); app::set_frame_type_cb( OS_SPACER_THIN_DOWN_FRAME, - aqua_spacer_thin_down_frame, + aqua_classic_spacer_thin_down_frame, 1, 1, 2, @@ -334,27 +334,27 @@ fn use_aqua_scheme() { ); app::set_frame_type_cb( OS_RADIO_ROUND_DOWN_BOX, - aqua_radio_round_down_box, + aqua_classic_radio_round_down_box, 2, 2, 4, 4, ); app::set_frame_type2(OS_HOVERED_UP_BOX, OS_BUTTON_UP_BOX); - app::set_frame_type_cb(OS_DEPRESSED_DOWN_BOX, aqua_depressed_down_box, 1, 1, 2, 2); + app::set_frame_type_cb(OS_DEPRESSED_DOWN_BOX, aqua_classic_depressed_down_box, 1, 1, 2, 2); app::set_frame_type2(OS_HOVERED_UP_FRAME, OS_BUTTON_UP_FRAME); app::set_frame_type_cb( OS_DEPRESSED_DOWN_FRAME, - aqua_depressed_down_frame, + aqua_classic_depressed_down_frame, 1, 1, 2, 2, ); - app::set_frame_type_cb(OS_INPUT_THIN_DOWN_BOX, aqua_input_thin_down_box, 2, 3, 4, 6); + app::set_frame_type_cb(OS_INPUT_THIN_DOWN_BOX, aqua_classic_input_thin_down_box, 2, 3, 4, 6); app::set_frame_type_cb( OS_INPUT_THIN_DOWN_FRAME, - aqua_input_thin_down_frame, + aqua_classic_input_thin_down_frame, 2, 3, 4, @@ -362,7 +362,7 @@ fn use_aqua_scheme() { ); app::set_frame_type_cb( OS_DEFAULT_BUTTON_UP_BOX, - aqua_default_button_up_box, + aqua_classic_default_button_up_box, 1, 1, 2, @@ -371,8 +371,8 @@ fn use_aqua_scheme() { app::set_frame_type2(OS_DEFAULT_HOVERED_UP_BOX, OS_HOVERED_UP_BOX); app::set_frame_type2(OS_DEFAULT_DEPRESSED_DOWN_BOX, OS_DEPRESSED_DOWN_BOX); app::set_frame_type2(OS_TOOLBAR_BUTTON_HOVER_BOX, FrameType::FlatBox); - app::set_frame_type_cb(OS_TABS_BOX, aqua_tabs_box, 2, 1, 4, 2); - app::set_frame_type_cb(OS_SWATCH_BOX, aqua_swatch_box, 2, 2, 4, 4); + app::set_frame_type_cb(OS_TABS_BOX, aqua_classic_tabs_box, 2, 1, 4, 2); + app::set_frame_type_cb(OS_SWATCH_BOX, aqua_classic_swatch_box, 2, 2, 4, 4); app::set_frame_type2(OS_MINI_BUTTON_UP_BOX, OS_BUTTON_UP_BOX); app::set_frame_type2(OS_MINI_DEPRESSED_DOWN_BOX, OS_DEPRESSED_DOWN_BOX); app::set_frame_type2(OS_MINI_BUTTON_UP_FRAME, OS_BUTTON_UP_FRAME); @@ -384,7 +384,7 @@ fn use_aqua_scheme() { // app::set_frame_type_cb(OS_BG_DOWN_BOX, OS_BG_BOX); } -fn use_aqua_colors() { +fn use_aqua_classic_colors() { app::background(0xED, 0xED, 0xED); app::background2(0xFF, 0xFF, 0xFF); app::foreground(0x00, 0x00, 0x00); @@ -395,8 +395,8 @@ fn use_aqua_colors() { Tooltip::set_text_color(Color::ForeGround); } -pub(crate) fn use_aqua_theme() { - use_aqua_scheme(); - use_aqua_colors(); +pub(crate) fn use_aqua_classic_theme() { + use_aqua_classic_scheme(); + use_aqua_classic_colors(); use_native_settings(); } diff --git a/src/widget_themes/aqua_dark.rs b/src/widget_themes/aqua_dark.rs new file mode 100644 index 0000000..acaae87 --- /dev/null +++ b/src/widget_themes/aqua_dark.rs @@ -0,0 +1,535 @@ +use super::*; +#[cfg(target_os = "macos")] +use crate::cocoa_helper::*; +use fltk::{app, enums::Color, misc::Tooltip}; + +#[cfg(target_os = "macos")] +fn convert_colors(colors: (f64, f64, f64, f64)) -> (u8, u8, u8, u8) { + let r = (colors.0 * 255.0) as u8; + let g = (colors.1 * 255.0) as u8; + let b = (colors.2 * 255.0) as u8; + let a = (colors.3 * 255.0) as u8; + (r, g, b, a) +} + +#[cfg(target_os = "macos")] +macro_rules! get_colors { + ($s:ident) => {{ + let mut r = 1.0; + let mut g = 1.0; + let mut b = 1.0; + let mut a = 1.0; + unsafe { + $s(&mut r, &mut g, &mut b, &mut a); + } + convert_colors((r, g, b, a)) + }}; +} + +#[cfg(target_os = "macos")] +lazy_static::lazy_static! { + static ref BG2_COL: (u8, u8, u8, u8) = (0, 0, 0, 255); + static ref BG_COL: (u8, u8, u8, u8) = get_colors!(my_windowBackgroundColor); + static ref FG_COL: (u8, u8, u8, u8) = get_colors!(my_labelColor); + static ref CONTROL_COL: (u8, u8, u8, u8) = get_colors!(my_controlBackgroundColor); + static ref FRAME_COL: (u8, u8, u8, u8) = get_colors!(my_windowFrameColor); + static ref LABEL2_COL: (u8, u8, u8, u8) = get_colors!(my_secondaryLabelColor); + static ref LABEL3_COL: (u8, u8, u8, u8) = get_colors!(my_tertiaryLabelColor); + static ref LABEL4_COL: (u8, u8, u8, u8) = get_colors!(my_quaternaryLabelColor); + static ref TXT_COL: (u8, u8, u8, u8) = get_colors!(my_textColor); + static ref PH_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_placeholderTextColor); + static ref SEL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedTextColor); + static ref TXT_BG_COL: (u8, u8, u8, u8) = get_colors!(my_textBackgroundColor); + static ref SEL_TXT_BG_COL: (u8, u8, u8, u8) = get_colors!(my_selectedTextBackgroundColor); + static ref KB_IND_COL: (u8, u8, u8, u8) = get_colors!(my_keyboardFocusIndicatorColor); + static ref SEL_TXT2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedTextColor); + static ref SEL_TXT_BG2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedTextBackgroundColor); + static ref LINK_COL: (u8, u8, u8, u8) = get_colors!(my_linkColor); + static ref SEP_COL: (u8, u8, u8, u8) = get_colors!(my_separatorColor); + static ref SEL_BG_COL: (u8, u8, u8, u8) = get_colors!(my_selectedContentBackgroundColor); + static ref SEL_BG2_COL: (u8, u8, u8, u8) = get_colors!(my_unemphasizedSelectedContentBackgroundColor); + static ref SEL_MEN_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedMenuItemTextColor); + static ref GRID_COL: (u8, u8, u8, u8) = get_colors!(my_gridColor); + static ref HDR_COL: (u8, u8, u8, u8) = get_colors!(my_headerTextColor); + static ref CTRL_ACC_COL: (u8, u8, u8, u8) = get_colors!(my_controlAccentColor); + static ref CTRL_COL: (u8, u8, u8, u8) = get_colors!(my_controlColor); + static ref CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_controlTextColor); + static ref DIS_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_disabledControlTextColor); + static ref SEL_CTRL_COL: (u8, u8, u8, u8) = get_colors!(my_selectedControlColor); + static ref SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_selectedControlTextColor); + static ref ALT_SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_alternateSelectedControlTextColor); + static ref SCRUB_BG_COL: (u8, u8, u8, u8) = get_colors!(my_scrubberTexturedBackgroundColor); + static ref WIN_FRM_TXT_COL: (u8, u8, u8, u8) = get_colors!(my_windowFrameTextColor); + static ref PAGE_BG_COL: (u8, u8, u8, u8) = get_colors!(my_underPageBackgroundColor); + static ref FIND_HLT_COL: (u8, u8, u8, u8) = get_colors!(my_findHighlightColor); + static ref HLT_COL: (u8, u8, u8, u8) = get_colors!(my_highlightColor); + static ref SHDW_COL: (u8, u8, u8, u8) = get_colors!(my_shadowColor); +} + +#[cfg(not(target_os = "macos"))] +lazy_static::lazy_static! { + static ref BG2_COL: (u8, u8, u8, u8) = (0, 0, 0, 255); + static ref BG_COL: (u8, u8, u8, u8) = (37, 37, 37, 255); + static ref FG_COL: (u8, u8, u8, u8) = (255, 254, 254, 216); + static ref CONTROL_COL: (u8, u8, u8, u8) = (22, 22, 22, 255); + static ref FRAME_COL: (u8, u8, u8, u8) = (153, 153, 153, 255); + static ref LABEL2_COL: (u8, u8, u8, u8) = (255, 254, 254, 140); + static ref LABEL3_COL: (u8, u8, u8, u8) = (255, 254, 254, 63); + static ref LABEL4_COL: (u8, u8, u8, u8) = (255, 254, 254, 25); + static ref TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref PH_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 63); + static ref SEL_TXT_COL: (u8, u8, u8, u8) = (255, 255, 255, 255); + static ref TXT_BG_COL: (u8, u8, u8, u8) = (22, 22, 22, 255); + static ref SEL_TXT_BG_COL: (u8, u8, u8, u8) = (48, 79, 120, 255); + static ref KB_IND_COL: (u8, u8, u8, u8) = (27, 149, 254, 76); + static ref SEL_TXT2_COL: (u8, u8, u8, u8) = (255, 255, 255, 255); + static ref SEL_TXT_BG2_COL: (u8, u8, u8, u8) = (54, 54, 54, 255); + static ref LINK_COL: (u8, u8, u8, u8) = (52, 134, 254, 255); + static ref SEP_COL: (u8, u8, u8, u8) = (255, 254, 254, 25); + static ref SEL_BG_COL: (u8, u8, u8, u8) = (5, 63, 197, 255); + static ref SEL_BG2_COL: (u8, u8, u8, u8) = (54, 54, 54, 255); + static ref SEL_MEN_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref GRID_COL: (u8, u8, u8, u8) = (20, 20, 20, 255); + static ref HDR_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref CTRL_ACC_COL: (u8, u8, u8, u8) = (10, 95, 254, 255); + static ref CTRL_COL: (u8, u8, u8, u8) = (255, 254, 254, 63); + static ref CTRL_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 216); + static ref DIS_CTRL_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 63); + static ref SEL_CTRL_COL: (u8, u8, u8, u8) = (48, 79, 120, 255); + static ref SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 216); + static ref ALT_SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref SCRUB_BG_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref WIN_FRM_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 216); + static ref PAGE_BG_COL: (u8, u8, u8, u8) = (29, 29, 29, 255); + static ref FIND_HLT_COL: (u8, u8, u8, u8) = (255, 255, 10, 255); + static ref HLT_COL: (u8, u8, u8, u8) = (164, 164, 164, 255); + static ref SHDW_COL: (u8, u8, u8, u8) = (0, 0, 0, 255); +} + +fn aqua_dark_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0x9A, 0x9A, 0x9A))); + draw_xyline(x + 3, y, x + w - 4); + // side outer borders + set_draw_color(activated_color(Color::from_rgb(0x91, 0x91, 0x91))); + draw_yxline(x, y + 3, y + h - 4); + draw_yxline(x + w - 1, y + 3, y + h - 4); + // bottom outer border + set_draw_color(activated_color(Color::from_rgb(0x90, 0x90, 0x90))); + draw_xyline(x + 3, y + h - 1, x + w - 4); + // top inner border + set_draw_color(activated_color(Color::from_rgb(0xFF, 0xFF, 0xFF))); + draw_xyline(x + 3, y + 1, x + w - 4); + // side top inner borders + set_draw_color(activated_color(Color::from_rgb(0xFC, 0xFC, 0xFC))); + draw_yxline(x + 1, y + 3, y + h / 2 - 1); + draw_yxline(x + w - 2, y + 3, y + h / 2 - 1); + // side bottom inner borders + set_draw_color(activated_color(Color::from_rgb(0xF4, 0xF4, 0xF4))); + draw_yxline(x + 1, y + h / 2 - 1, y + h - 4); + draw_yxline(x + w - 2, y + 3, y + h - 4); + // bottom inner border + set_draw_color(activated_color(Color::from_rgb(0xF3, 0xF2, 0xF0))); + draw_xyline(x + 3, y + h - 2, x + w - 4); + // corners + set_draw_color(activated_color(Color::from_rgb(0xAF, 0xAF, 0xAF))); + draw_arc(x, y, 8, 8, 90.0, 180.0); + draw_arc(x, y + h - 8, 8, 8, 180.0, 270.0); + draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); + draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); +} + +fn aqua_dark_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + if w >= h { + // top gradient + vertical_gradient( + x + 2, + y + 2, + x + w - 3, + y + h / 2 - 1, + Color::from_rgb(0xFF, 0xFF, 0xFF), + Color::from_rgb(0xF6, 0xF5, 0xF4), + ); + // bottom fill + set_draw_color(activated_color(Color::from_rgb(0xED, 0xEC, 0xEA))); + draw_rectf(x + 2, y + h / 2, w - 4, h - h / 2 - 3); + // bottom gradient + set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); + draw_xyline(x + 2, y + h - 3, x + w - 3); + } else { + // left gradient + horizontal_gradient( + x + 2, + y + 2, + x + w / 2 - 1, + y + h - 3, + Color::from_rgb(0xFF, 0xFF, 0xFF), + Color::from_rgb(0xF6, 0xF5, 0xF4), + ); + // right fill + set_draw_color(activated_color(Color::from_rgb(0xED, 0xEC, 0xEA))); + draw_rectf(x + w / 2, y + 2, w - w / 2 - 3, h - 4); + // right gradient + set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); + draw_yxline(x + w - 3, y + 2, y + h - 3); + } + aqua_dark_button_up_frame(x, y, w, h, c); +} + +fn aqua_dark_panel_thin_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(devalued(c, 0.06751))); + draw_rect(x, y, w, h); +} + +fn aqua_dark_panel_thin_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(c)); + draw_rectf(x + 1, y + 1, w - 2, h - 2); + aqua_dark_panel_thin_up_frame(x, y, w, h, c); +} + +fn aqua_dark_spacer_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top and left borders + set_draw_color(activated_color(Color::from_rgb(0xD6, 0xD6, 0xD6))); + draw_yxline2(x, y + h - 2, y, x + w - 2); + // bottom and right borders + set_draw_color(activated_color(Color::from_rgb(0xF3, 0xF3, 0xF3))); + draw_xyline2(x, y + h - 1, x + w - 1, y); +} + +fn aqua_dark_spacer_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(c)); + draw_rectf(x + 1, y + 1, w - 2, h - 2); + aqua_dark_spacer_thin_down_frame(x, y, w, h, c); +} + +fn aqua_dark_radio_round_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(devalued(c, 0.42194))); + draw_arc(x, y, w, h, 0.0, 360.0); +} + +fn aqua_dark_radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top edges + set_draw_color(activated_color(Color::from_rgb(0xF6, 0xF6, 0xF6))); + draw_arc(x + 1, y + 1, w - 2, h - 2, 0.0, 180.0); + // bottom edges + set_draw_color(activated_color(Color::from_rgb(0xEB, 0xEB, 0xEB))); + draw_arc(x + 1, y + 1, w - 2, h - 2, 180.0, 360.0); + // top gradient + vertical_gradient( + x + 2, + y + 2, + x + w - 3, + y + h / 2 - 1, + Color::from_rgb(0xFF, 0xFF, 0xFF), + Color::from_rgb(0xF6, 0xF5, 0xF4), + ); + // bottom fill + set_draw_color(activated_color(Color::from_rgb(0xED, 0xEC, 0xEA))); + draw_rectf(x + 2, y + h / 2, w - 4, h - h / 2 - 3); + // bottom gradient + set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); + draw_xyline(x + 2, y + h - 3, x + w - 3); + aqua_dark_radio_round_down_frame(x, y, w, h, c); +} + +fn aqua_dark_depressed_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0x4C, 0x54, 0xAA))); + draw_xyline(x + 3, y, x + w - 4); + // side outer borders + set_draw_color(activated_color(Color::from_rgb(0x49, 0x4C, 0x8F))); + draw_yxline(x, y + 3, y + h - 4); + draw_yxline(x + w - 1, y + 3, y + h - 4); + // bottom outer border + set_draw_color(activated_color(Color::from_rgb(0x43, 0x46, 0x72))); + draw_xyline(x + 3, y + h - 1, x + w - 4); + // top inner border + set_draw_color(activated_color(Color::from_rgb(0xBC, 0xD6, 0xEF))); + draw_xyline(x + 3, y + 1, x + w - 4); + // side top inner borders + set_draw_color(activated_color(Color::from_rgb(0x7C, 0xAB, 0xE9))); + draw_yxline(x + 1, y + 3, y + h / 2 - 1); + draw_yxline(x + w - 2, y + 3, y + h / 2 - 1); + // side bottom inner borders + set_draw_color(activated_color(Color::from_rgb(0x5F, 0xA1, 0xEA))); + draw_yxline(x + 1, y + h / 2, y + h - 4); + draw_yxline(x + w - 2, y + h / 2, y + h - 4); + // top corners + set_draw_color(activated_color(Color::from_rgb(0x79, 0x81, 0xBC))); + draw_arc(x, y, 8, 8, 90.0, 180.0); + draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); + // bottom corners + set_draw_color(activated_color(Color::from_rgb(0x72, 0x79, 0x96))); + draw_arc(x, y + h - 8, 8, 8, 180.0, 270.0); + draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); +} + +fn aqua_dark_depressed_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top gradient + vertical_gradient( + x + 2, + y + 2, + x + w - 3, + y + h / 2 - 1, + Color::from_rgb(0xA3, 0xC1, 0xEF), + Color::from_rgb(0x67, 0xA1, 0xE9), + ); + // bottom gradient + vertical_gradient( + x + 2, + y + h / 2, + x + w - 3, + y + h - 2, + Color::from_rgb(0x46, 0x93, 0xE9), + Color::from_rgb(0xAA, 0xD4, 0xF0), + ); + aqua_dark_depressed_down_frame(x, y, w, h, c); +} + +fn aqua_dark_input_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0x9B, 0x9B, 0x9B))); + draw_xyline(x, y, x + w - 1); + // side and bottom outer borders + set_draw_color(activated_color(Color::from_rgb(0xBA, 0xBA, 0xBA))); + draw_yxline3(x, y + 1, y + h - 1, x + w - 1, y + 1); + // top shadow + set_draw_color(activated_color(Color::from_rgb(0xE3, 0xE3, 0xE3))); + draw_xyline(x + 1, y + 1, x + w - 2); + // inner border + set_draw_color(activated_color(Color::from_rgb(0xF5, 0xF5, 0xF5))); + draw_yxline3(x + 1, y + h - 2, y + 2, x + w - 2, y + h - 2); +} + +fn aqua_dark_input_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(Color::from_rgb(0xFF, 0xFF, 0xFF))); + draw_rectf(x + 2, y + 3, w - 4, h - 4); + aqua_dark_input_thin_down_frame(x, y, w, h, c); +} + +fn aqua_dark_default_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0x4E, 0x59, 0xA6))); + draw_xyline(x + 3, y, x + w - 4); + // side outer borders + set_draw_color(activated_color(Color::from_rgb(0x4C, 0x52, 0x89))); + draw_yxline(x, y + 3, y + h - 4); + draw_yxline(x + w - 1, y + 3, y + h - 4); + // bottom outer border + set_draw_color(activated_color(Color::from_rgb(0x48, 0x4F, 0x69))); + draw_xyline(x + 3, y + h - 1, x + w - 4); + // top inner border + set_draw_color(activated_color(Color::from_rgb(0xD0, 0xEA, 0xF6))); + draw_xyline(x + 3, y + 1, x + w - 4); + // side top inner borders + set_draw_color(activated_color(Color::from_rgb(0x7A, 0xBF, 0xEF))); + draw_yxline(x + 1, y + 3, y + h / 2 - 1); + draw_yxline(x + w - 2, y + 3, y + h / 2 - 1); + // side bottom inner borders + set_draw_color(activated_color(Color::from_rgb(0x53, 0xAF, 0xEF))); + draw_yxline(x + 1, y + h / 2, y + h - 4); + draw_yxline(x + w - 2, y + h / 2, y + h - 4); + // top corners + set_draw_color(activated_color(Color::from_rgb(0x76, 0x80, 0xB5))); + draw_arc(x, y, 8, 8, 90.0, 180.0); + draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); + // bottom corners + set_draw_color(activated_color(Color::from_rgb(0x6F, 0x75, 0x89))); + draw_arc(x, y + h - 8, 8, 8, 180.0, 270.0); + draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); +} + +fn aqua_dark_default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top gradient + vertical_gradient( + x + 2, + y + 2, + x + w - 3, + y + h / 2 - 1, + Color::from_rgb(0xBF, 0xDC, 0xF7), + Color::from_rgb(0x84, 0xC4, 0xF1), + ); + // bottom gradient + vertical_gradient( + x + 2, + y + h / 2, + x + w - 3, + y + h - 2, + Color::from_rgb(0x59, 0xB5, 0xF1), + Color::from_rgb(0xBA, 0xE9, 0xF7), + ); + aqua_dark_default_button_up_frame(x, y, w, h, c); +} + +fn aqua_dark_tabs_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // top outer border + set_draw_color(activated_color(Color::from_rgb(0xAE, 0xAE, 0xAE))); + draw_xyline(x + 3, y, x + w - 4); + // side outer borders + set_draw_color(activated_color(Color::from_rgb(0x9E, 0x9E, 0x9E))); + draw_yxline(x, y + 3, y + h - 4); + draw_yxline(x + w - 1, y + 3, y + h - 4); + // bottom outer border + set_draw_color(activated_color(Color::from_rgb(0x8E, 0x8E, 0x8E))); + draw_xyline(x + 3, y + h - 1, x + w - 4); + // top inner border + set_draw_color(activated_color(Color::from_rgb(0xFA, 0xFA, 0xFA))); + draw_xyline(x + 3, y + 1, x + w - 4); + // side inner borders + set_draw_color(activated_color(Color::from_rgb(0xF6, 0xF6, 0xF6))); + draw_yxline(x + 1, y + 3, y + h - 4); + draw_yxline(x + w - 2, y + 3, y + h - 4); + // bottom inner border + set_draw_color(activated_color(Color::from_rgb(0xF2, 0xF2, 0xF2))); + draw_xyline(x + 3, y + h - 2, x + w - 4); + // top corners + set_draw_color(activated_color(Color::from_rgb(0xA4, 0xA4, 0xA4))); + draw_arc(x, y, 8, 8, 90.0, 180.0); + draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); + // bottom corners + set_draw_color(activated_color(Color::from_rgb(0x94, 0x94, 0x94))); + draw_arc(x, y + h - 8, 8, 8, 180.0, 270.0); + draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); +} + +fn aqua_dark_tabs_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(c)); + draw_rectf(x + 2, y + 2, w - 4, h - 4); + aqua_dark_tabs_frame(x, y, w, h, c); +} + +fn aqua_dark_swatch_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { + // outer border + set_draw_color(activated_color(Color::from_rgb(0xA3, 0xA3, 0xA3))); + draw_rect(x, y, w, h); + // inner border + set_draw_color(activated_color(Color::from_rgb(0xFF, 0xFF, 0xFF))); + draw_rect(x + 1, y + 1, w - 2, h - 2); +} + +fn aqua_dark_swatch_box(x: i32, y: i32, w: i32, h: i32, c: Color) { + set_draw_color(activated_color(c)); + draw_rectf(x + 2, y + 2, w - 4, h - 4); + aqua_dark_swatch_frame(x, y, w, h, c); +} + +fn use_aqua_dark_scheme() { + app::set_scheme(app::Scheme::Gtk); + app::set_frame_type_cb(OS_BUTTON_UP_BOX, aqua_dark_button_up_box, 1, 1, 2, 2); + app::set_frame_type2(OS_CHECK_DOWN_BOX, OS_BUTTON_UP_BOX); + app::set_frame_type_cb(OS_BUTTON_UP_FRAME, aqua_dark_button_up_frame, 1, 1, 2, 2); + app::set_frame_type2(OS_CHECK_DOWN_FRAME, OS_BUTTON_UP_FRAME); + app::set_frame_type_cb( + OS_PANEL_THIN_UP_BOX, + aqua_dark_panel_thin_up_box, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb( + OS_SPACER_THIN_DOWN_BOX, + aqua_dark_spacer_thin_down_box, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb( + OS_PANEL_THIN_UP_FRAME, + aqua_dark_panel_thin_up_frame, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb( + OS_SPACER_THIN_DOWN_FRAME, + aqua_dark_spacer_thin_down_frame, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb( + OS_RADIO_ROUND_DOWN_BOX, + aqua_dark_radio_round_down_box, + 2, + 2, + 4, + 4, + ); + app::set_frame_type2(OS_HOVERED_UP_BOX, OS_BUTTON_UP_BOX); + app::set_frame_type_cb( + OS_DEPRESSED_DOWN_BOX, + aqua_dark_depressed_down_box, + 1, + 1, + 2, + 2, + ); + app::set_frame_type2(OS_HOVERED_UP_FRAME, OS_BUTTON_UP_FRAME); + app::set_frame_type_cb( + OS_DEPRESSED_DOWN_FRAME, + aqua_dark_depressed_down_frame, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb( + OS_INPUT_THIN_DOWN_BOX, + aqua_dark_input_thin_down_box, + 2, + 3, + 4, + 6, + ); + app::set_frame_type_cb( + OS_INPUT_THIN_DOWN_FRAME, + aqua_dark_input_thin_down_frame, + 2, + 3, + 4, + 6, + ); + app::set_frame_type_cb( + OS_DEFAULT_BUTTON_UP_BOX, + aqua_dark_default_button_up_box, + 1, + 1, + 2, + 2, + ); + app::set_frame_type2(OS_DEFAULT_HOVERED_UP_BOX, OS_HOVERED_UP_BOX); + app::set_frame_type2(OS_DEFAULT_DEPRESSED_DOWN_BOX, OS_DEPRESSED_DOWN_BOX); + app::set_frame_type2(OS_TOOLBAR_BUTTON_HOVER_BOX, FrameType::FlatBox); + app::set_frame_type_cb(OS_TABS_BOX, aqua_dark_tabs_box, 2, 1, 4, 2); + app::set_frame_type_cb(OS_SWATCH_BOX, aqua_dark_swatch_box, 2, 2, 4, 4); + app::set_frame_type2(OS_MINI_BUTTON_UP_BOX, OS_BUTTON_UP_BOX); + app::set_frame_type2(OS_MINI_DEPRESSED_DOWN_BOX, OS_DEPRESSED_DOWN_BOX); + app::set_frame_type2(OS_MINI_BUTTON_UP_FRAME, OS_BUTTON_UP_FRAME); + app::set_frame_type2(OS_MINI_DEPRESSED_DOWN_FRAME, OS_DEPRESSED_DOWN_FRAME); + app::set_frame_type2(FrameType::UpBox, OS_BUTTON_UP_BOX); + app::set_frame_type2(FrameType::DownBox, OS_BUTTON_UP_BOX); + app::set_frame_type2(FrameType::RoundDownBox, OS_RADIO_ROUND_DOWN_BOX); + app::set_frame_type2(OS_BG_BOX, FrameType::FlatBox); + // app::set_frame_type_cb(OS_BG_DOWN_BOX, OS_BG_BOX); +} + +fn use_aqua_dark_colors() { + app::background(BG_COL.0, BG_COL.1, BG_COL.2); + app::foreground(FG_COL.0, FG_COL.1, FG_COL.2); + app::background2(BG2_COL.0, BG2_COL.1, BG2_COL.2); + app::set_color(Color::Inactive, 0x4D, 0x4D, 0x69); + app::set_color(Color::Selection, 0x30, 0x60, 0xF6); + app::set_color(Color::Free, 0xFB, 0xFB, 0xFB); + Tooltip::set_color(Color::from_rgb(0xFF, 0xFF, 0xC7)); + Tooltip::set_text_color(Color::ForeGround); +} + +pub(crate) fn use_aqua_dark_theme() { + use_aqua_dark_scheme(); + use_aqua_dark_colors(); + use_native_settings(); +} diff --git a/src/widget_themes/aqua2.rs b/src/widget_themes/aqua_light.rs similarity index 73% rename from src/widget_themes/aqua2.rs rename to src/widget_themes/aqua_light.rs index cee956f..30df1b8 100644 --- a/src/widget_themes/aqua2.rs +++ b/src/widget_themes/aqua_light.rs @@ -1,7 +1,9 @@ use super::*; +#[cfg(target_os = "macos")] use crate::cocoa_helper::*; use fltk::{app, enums::Color, misc::Tooltip}; +#[cfg(target_os = "macos")] fn convert_colors(colors: (f64, f64, f64, f64)) -> (u8, u8, u8, u8) { let r = (colors.0 * 255.0) as u8; let g = (colors.1 * 255.0) as u8; @@ -10,6 +12,7 @@ fn convert_colors(colors: (f64, f64, f64, f64)) -> (u8, u8, u8, u8) { (r, g, b, a) } +#[cfg(target_os = "macos")] macro_rules! get_colors { ($s:ident) => {{ let mut r = 1.0; @@ -23,16 +26,11 @@ macro_rules! get_colors { }}; } +#[cfg(target_os = "macos")] lazy_static::lazy_static! { + static ref BG2_COL: (u8, u8, u8, u8) = (0, 0, 0, 255); static ref BG_COL: (u8, u8, u8, u8) = get_colors!(my_windowBackgroundColor); static ref FG_COL: (u8, u8, u8, u8) = get_colors!(my_labelColor); - static ref BG2_COL: (u8, u8, u8, u8) = { - if FG_COL.0 > 250 && FG_COL.1 > 250 && FG_COL.2 > 250 { - (0, 0, 0, 255) - } else { - (255, 255, 255, 255) - } - }; static ref CONTROL_COL: (u8, u8, u8, u8) = get_colors!(my_controlBackgroundColor); static ref FRAME_COL: (u8, u8, u8, u8) = get_colors!(my_windowFrameColor); static ref LABEL2_COL: (u8, u8, u8, u8) = get_colors!(my_secondaryLabelColor); @@ -68,7 +66,47 @@ lazy_static::lazy_static! { static ref SHDW_COL: (u8, u8, u8, u8) = get_colors!(my_shadowColor); } -fn aqua2_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +#[cfg(not(target_os = "macos"))] +lazy_static::lazy_static! { + static ref BG2_COL: (u8, u8, u8, u8) = (255, 255, 255, 255); + static ref BG_COL: (u8, u8, u8, u8) = (231, 231, 231, 255); + static ref FG_COL: (u8, u8, u8, u8) = (0, 0, 0, 216); + static ref CONTROL_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref FRAME_COL: (u8, u8, u8, u8) = (153, 153, 153, 255); + static ref LABEL2_COL: (u8, u8, u8, u8) = (0, 0, 0, 127); + static ref LABEL3_COL: (u8, u8, u8, u8) = (0, 0, 0, 66); + static ref LABEL4_COL: (u8, u8, u8, u8) = (0, 0, 0, 25); + static ref TXT_COL: (u8, u8, u8, u8) = (0, 0, 0, 255); + static ref PH_TXT_COL: (u8, u8, u8, u8) = (0, 0, 0, 63); + static ref SEL_TXT_COL: (u8, u8, u8, u8) = (0, 0, 0, 255); + static ref TXT_BG_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref SEL_TXT_BG_COL: (u8, u8, u8, u8) = (164, 204, 254, 255); + static ref KB_IND_COL: (u8, u8, u8, u8) = (7, 75, 240, 63); + static ref SEL_TXT2_COL: (u8, u8, u8, u8) = (0, 0, 0, 255); + static ref SEL_TXT_BG2_COL: (u8, u8, u8, u8) = (211, 211, 211, 255); + static ref LINK_COL: (u8, u8, u8, u8) = (8, 79, 209, 255); + static ref SEP_COL: (u8, u8, u8, u8) = (0, 0, 0, 25); + static ref SEL_BG_COL: (u8, u8, u8, u8) = (7, 73, 217, 255); + static ref SEL_BG2_COL: (u8, u8, u8, u8) = (211, 211, 211, 255); + static ref SEL_MEN_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref GRID_COL: (u8, u8, u8, u8) = (223, 223, 223, 255); + static ref HDR_COL: (u8, u8, u8, u8) = (0, 0, 0, 216); + static ref CTRL_ACC_COL: (u8, u8, u8, u8) = (10, 95, 254, 255); + static ref CTRL_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref CTRL_TXT_COL: (u8, u8, u8, u8) = (0, 0, 0, 216); + static ref DIS_CTRL_TXT_COL: (u8, u8, u8, u8) = (0, 0, 0, 63); + static ref SEL_CTRL_COL: (u8, u8, u8, u8) = (164, 204, 254, 255); + static ref SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = (0, 0, 0, 216); + static ref ALT_SEL_CTRL_TXT_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref SCRUB_BG_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref WIN_FRM_TXT_COL: (u8, u8, u8, u8) = (0, 0, 0, 216); + static ref PAGE_BG_COL: (u8, u8, u8, u8) = (131, 131, 131, 229); + static ref FIND_HLT_COL: (u8, u8, u8, u8) = (255, 255, 10, 255); + static ref HLT_COL: (u8, u8, u8, u8) = (255, 254, 254, 255); + static ref SHDW_COL: (u8, u8, u8, u8) = (0, 0, 0, 255); +} + +fn aqua_light_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0x9A, 0x9A, 0x9A))); draw_xyline(x + 3, y, x + w - 4); @@ -101,7 +139,7 @@ fn aqua2_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_arc(x + w - 8, y, 8, 8, 0.0, 90.0); } -fn aqua2_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { if w >= h { // top gradient vertical_gradient( @@ -135,21 +173,21 @@ fn aqua2_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); draw_yxline(x + w - 3, y + 2, y + h - 3); } - aqua2_button_up_frame(x, y, w, h, c); + aqua_light_button_up_frame(x, y, w, h, c); } -fn aqua2_panel_thin_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_panel_thin_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(devalued(c, 0.06751))); draw_rect(x, y, w, h); } -fn aqua2_panel_thin_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_panel_thin_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(c)); draw_rectf(x + 1, y + 1, w - 2, h - 2); - aqua2_panel_thin_up_frame(x, y, w, h, c); + aqua_light_panel_thin_up_frame(x, y, w, h, c); } -fn aqua2_spacer_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_spacer_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top and left borders set_draw_color(activated_color(Color::from_rgb(0xD6, 0xD6, 0xD6))); draw_yxline2(x, y + h - 2, y, x + w - 2); @@ -158,18 +196,18 @@ fn aqua2_spacer_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_xyline2(x, y + h - 1, x + w - 1, y); } -fn aqua2_spacer_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_spacer_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(c)); draw_rectf(x + 1, y + 1, w - 2, h - 2); - aqua2_spacer_thin_down_frame(x, y, w, h, c); + aqua_light_spacer_thin_down_frame(x, y, w, h, c); } -fn aqua2_radio_round_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_radio_round_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(devalued(c, 0.42194))); draw_arc(x, y, w, h, 0.0, 360.0); } -fn aqua2_radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { // top edges set_draw_color(activated_color(Color::from_rgb(0xF6, 0xF6, 0xF6))); draw_arc(x + 1, y + 1, w - 2, h - 2, 0.0, 180.0); @@ -191,10 +229,10 @@ fn aqua2_radio_round_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { // bottom gradient set_draw_color(activated_color(Color::from_rgb(0xEF, 0xEE, 0xEC))); draw_xyline(x + 2, y + h - 3, x + w - 3); - aqua2_radio_round_down_frame(x, y, w, h, c); + aqua_light_radio_round_down_frame(x, y, w, h, c); } -fn aqua2_depressed_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_depressed_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0x4C, 0x54, 0xAA))); draw_xyline(x + 3, y, x + w - 4); @@ -226,7 +264,7 @@ fn aqua2_depressed_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); } -fn aqua2_depressed_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_depressed_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { // top gradient vertical_gradient( x + 2, @@ -245,10 +283,10 @@ fn aqua2_depressed_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { Color::from_rgb(0x46, 0x93, 0xE9), Color::from_rgb(0xAA, 0xD4, 0xF0), ); - aqua2_depressed_down_frame(x, y, w, h, c); + aqua_light_depressed_down_frame(x, y, w, h, c); } -fn aqua2_input_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_input_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0x9B, 0x9B, 0x9B))); draw_xyline(x, y, x + w - 1); @@ -263,13 +301,13 @@ fn aqua2_input_thin_down_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_yxline3(x + 1, y + h - 2, y + 2, x + w - 2, y + h - 2); } -fn aqua2_input_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_input_thin_down_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(Color::from_rgb(0xFF, 0xFF, 0xFF))); draw_rectf(x + 2, y + 3, w - 4, h - 4); - aqua2_input_thin_down_frame(x, y, w, h, c); + aqua_light_input_thin_down_frame(x, y, w, h, c); } -fn aqua2_default_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_default_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0x4E, 0x59, 0xA6))); draw_xyline(x + 3, y, x + w - 4); @@ -301,7 +339,7 @@ fn aqua2_default_button_up_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); } -fn aqua2_default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { // top gradient vertical_gradient( x + 2, @@ -320,10 +358,10 @@ fn aqua2_default_button_up_box(x: i32, y: i32, w: i32, h: i32, c: Color) { Color::from_rgb(0x59, 0xB5, 0xF1), Color::from_rgb(0xBA, 0xE9, 0xF7), ); - aqua2_default_button_up_frame(x, y, w, h, c); + aqua_light_default_button_up_frame(x, y, w, h, c); } -fn aqua2_tabs_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_tabs_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // top outer border set_draw_color(activated_color(Color::from_rgb(0xAE, 0xAE, 0xAE))); draw_xyline(x + 3, y, x + w - 4); @@ -354,13 +392,13 @@ fn aqua2_tabs_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_arc(x + w - 8, y + h - 8, 8, 8, 270.0, 360.0); } -fn aqua2_tabs_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_tabs_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(c)); draw_rectf(x + 2, y + 2, w - 4, h - 4); - aqua2_tabs_frame(x, y, w, h, c); + aqua_light_tabs_frame(x, y, w, h, c); } -fn aqua2_swatch_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_swatch_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { // outer border set_draw_color(activated_color(Color::from_rgb(0xA3, 0xA3, 0xA3))); draw_rect(x, y, w, h); @@ -369,31 +407,45 @@ fn aqua2_swatch_frame(x: i32, y: i32, w: i32, h: i32, c: Color) { draw_rect(x + 1, y + 1, w - 2, h - 2); } -fn aqua2_swatch_box(x: i32, y: i32, w: i32, h: i32, c: Color) { +fn aqua_light_swatch_box(x: i32, y: i32, w: i32, h: i32, c: Color) { set_draw_color(activated_color(c)); draw_rectf(x + 2, y + 2, w - 4, h - 4); - aqua2_swatch_frame(x, y, w, h, c); + aqua_light_swatch_frame(x, y, w, h, c); } -fn use_aqua2_scheme() { +fn use_aqua_light_scheme() { app::set_scheme(app::Scheme::Gtk); - app::set_frame_type_cb(OS_BUTTON_UP_BOX, aqua2_button_up_box, 1, 1, 2, 2); + app::set_frame_type_cb(OS_BUTTON_UP_BOX, aqua_light_button_up_box, 1, 1, 2, 2); app::set_frame_type2(OS_CHECK_DOWN_BOX, OS_BUTTON_UP_BOX); - app::set_frame_type_cb(OS_BUTTON_UP_FRAME, aqua2_button_up_frame, 1, 1, 2, 2); + app::set_frame_type_cb(OS_BUTTON_UP_FRAME, aqua_light_button_up_frame, 1, 1, 2, 2); app::set_frame_type2(OS_CHECK_DOWN_FRAME, OS_BUTTON_UP_FRAME); - app::set_frame_type_cb(OS_PANEL_THIN_UP_BOX, aqua2_panel_thin_up_box, 1, 1, 2, 2); + app::set_frame_type_cb( + OS_PANEL_THIN_UP_BOX, + aqua_light_panel_thin_up_box, + 1, + 1, + 2, + 2, + ); app::set_frame_type_cb( OS_SPACER_THIN_DOWN_BOX, - aqua2_spacer_thin_down_box, + aqua_light_spacer_thin_down_box, + 1, + 1, + 2, + 2, + ); + app::set_frame_type_cb( + OS_PANEL_THIN_UP_FRAME, + aqua_light_panel_thin_up_frame, 1, 1, 2, 2, ); - app::set_frame_type_cb(OS_PANEL_THIN_UP_FRAME, aqua2_panel_thin_up_frame, 1, 1, 2, 2); app::set_frame_type_cb( OS_SPACER_THIN_DOWN_FRAME, - aqua2_spacer_thin_down_frame, + aqua_light_spacer_thin_down_frame, 1, 1, 2, @@ -401,27 +453,41 @@ fn use_aqua2_scheme() { ); app::set_frame_type_cb( OS_RADIO_ROUND_DOWN_BOX, - aqua2_radio_round_down_box, + aqua_light_radio_round_down_box, 2, 2, 4, 4, ); app::set_frame_type2(OS_HOVERED_UP_BOX, OS_BUTTON_UP_BOX); - app::set_frame_type_cb(OS_DEPRESSED_DOWN_BOX, aqua2_depressed_down_box, 1, 1, 2, 2); + app::set_frame_type_cb( + OS_DEPRESSED_DOWN_BOX, + aqua_light_depressed_down_box, + 1, + 1, + 2, + 2, + ); app::set_frame_type2(OS_HOVERED_UP_FRAME, OS_BUTTON_UP_FRAME); app::set_frame_type_cb( OS_DEPRESSED_DOWN_FRAME, - aqua2_depressed_down_frame, + aqua_light_depressed_down_frame, 1, 1, 2, 2, ); - app::set_frame_type_cb(OS_INPUT_THIN_DOWN_BOX, aqua2_input_thin_down_box, 2, 3, 4, 6); + app::set_frame_type_cb( + OS_INPUT_THIN_DOWN_BOX, + aqua_light_input_thin_down_box, + 2, + 3, + 4, + 6, + ); app::set_frame_type_cb( OS_INPUT_THIN_DOWN_FRAME, - aqua2_input_thin_down_frame, + aqua_light_input_thin_down_frame, 2, 3, 4, @@ -429,7 +495,7 @@ fn use_aqua2_scheme() { ); app::set_frame_type_cb( OS_DEFAULT_BUTTON_UP_BOX, - aqua2_default_button_up_box, + aqua_light_default_button_up_box, 1, 1, 2, @@ -438,8 +504,8 @@ fn use_aqua2_scheme() { app::set_frame_type2(OS_DEFAULT_HOVERED_UP_BOX, OS_HOVERED_UP_BOX); app::set_frame_type2(OS_DEFAULT_DEPRESSED_DOWN_BOX, OS_DEPRESSED_DOWN_BOX); app::set_frame_type2(OS_TOOLBAR_BUTTON_HOVER_BOX, FrameType::FlatBox); - app::set_frame_type_cb(OS_TABS_BOX, aqua2_tabs_box, 2, 1, 4, 2); - app::set_frame_type_cb(OS_SWATCH_BOX, aqua2_swatch_box, 2, 2, 4, 4); + app::set_frame_type_cb(OS_TABS_BOX, aqua_light_tabs_box, 2, 1, 4, 2); + app::set_frame_type_cb(OS_SWATCH_BOX, aqua_light_swatch_box, 2, 2, 4, 4); app::set_frame_type2(OS_MINI_BUTTON_UP_BOX, OS_BUTTON_UP_BOX); app::set_frame_type2(OS_MINI_DEPRESSED_DOWN_BOX, OS_DEPRESSED_DOWN_BOX); app::set_frame_type2(OS_MINI_BUTTON_UP_FRAME, OS_BUTTON_UP_FRAME); @@ -451,7 +517,7 @@ fn use_aqua2_scheme() { // app::set_frame_type_cb(OS_BG_DOWN_BOX, OS_BG_BOX); } -fn use_aqua2_colors() { +fn use_aqua_light_colors() { app::background(BG_COL.0, BG_COL.1, BG_COL.2); app::foreground(FG_COL.0, FG_COL.1, FG_COL.2); app::background2(BG2_COL.0, BG2_COL.1, BG2_COL.2); @@ -462,8 +528,8 @@ fn use_aqua2_colors() { Tooltip::set_text_color(Color::ForeGround); } -pub(crate) fn use_aqua2_theme() { - use_aqua2_scheme(); - use_aqua2_colors(); +pub(crate) fn use_aqua_light_theme() { + use_aqua_light_scheme(); + use_aqua_light_colors(); use_native_settings(); } diff --git a/src/widget_themes/mod.rs b/src/widget_themes/mod.rs index 1355bf9..2505f14 100644 --- a/src/widget_themes/mod.rs +++ b/src/widget_themes/mod.rs @@ -10,9 +10,9 @@ use fltk::{ }; pub(crate) mod aero; -pub(crate) mod aqua; -#[cfg(target_os = "macos")] -pub(crate) mod aqua2; +pub(crate) mod aqua_classic; +pub(crate) mod aqua_dark; +pub(crate) mod aqua_light; pub(crate) mod blue; pub(crate) mod classic; pub(crate) mod dark;