From 59c34d6aca52c60b9f90a8e17c1bae2572dd9b3a Mon Sep 17 00:00:00 2001 From: mars Date: Sat, 19 Nov 2022 13:09:53 -0700 Subject: [PATCH] Clean up SAO UI color definitions --- scripts/sao-ui/src/style.rs | 109 +++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/scripts/sao-ui/src/style.rs b/scripts/sao-ui/src/style.rs index 0030c38..c56e702 100644 --- a/scripts/sao-ui/src/style.rs +++ b/scripts/sao-ui/src/style.rs @@ -24,6 +24,11 @@ pub const BASE_ALPHA: u8 = 0xc0; /// The common base_hover color alpha shared between all themes. pub const BASE_HOVER_ALPHA: u8 = 0xe0; +/// Converts 0xrrggbb hex to an opaque [Color]. +pub const fn hex(rgb: u32) -> Color { + Color((rgb << 8) | 0xff) +} + /// Sword Art Online color palette. pub const SAO_PALETTE: Palette = Palette { base: Color::WHITE.with_alpha(BASE_ALPHA), @@ -44,66 +49,66 @@ pub const SAO_PALETTE: Palette = Palette { /// Rose Pine color palette. pub const ROSE_PINE_PALETTE: Palette = Palette { - base: Color(0x191724ff).with_alpha(BASE_ALPHA), - base_hover: Color(0x21202ee0).with_alpha(BASE_HOVER_ALPHA), // Highlight Low - base_active: Color(0x403d52ff), // Highlight Med - surface: Color(0x1f1d2eff), - overlay: Color(0x26233aff), - text: Color(0xe0def4ff), - black: Color(0x6e6a86ff), // Muted - red: Color(0xeb6f92ff), // Love - green: Color(0x7fb59fff), // ??? (not in Rose Pine?) - yellow: Color(0xf6c177ff), // Gold - blue: Color(0x31748fff), // Pine - magenta: Color(0xc4a7e7ff), // Iris - cyan: Color(0x9ccfd8ff), // Foam - white: Color(0xe0def4ff), // Text + base: hex(0x191724).with_alpha(BASE_ALPHA), + base_hover: hex(0x21202ee0).with_alpha(BASE_HOVER_ALPHA), // Highlight Low + base_active: hex(0x403d52), // Highlight Med + surface: hex(0x1f1d2e), + overlay: hex(0x26233a), + text: hex(0xe0def4), + black: hex(0x6e6a86), // Muted + red: hex(0xeb6f92), // Love + green: hex(0x7fb59f), // ??? (not in Rose Pine?) + yellow: hex(0xf6c177), // Gold + blue: hex(0x31748f), // Pine + magenta: hex(0xc4a7e7), // Iris + cyan: hex(0x9ccfd8), // Foam + white: hex(0xe0def4), // Text }; /// Rose Pine Moon color palette. pub const ROSE_PINE_MOON_PALETTE: Palette = Palette { - base: Color(0x232136ff).with_alpha(BASE_ALPHA), - base_hover: Color(0x2a283eff).with_alpha(BASE_HOVER_ALPHA), // Highlight Low - base_active: Color(0x44415aff), // Highlight Med - surface: Color(0x2a273fff), - overlay: Color(0x393552), - text: Color(0xe0def4ff), - black: Color(0x6e6a86ff), // Muted - red: Color(0xeb6f92ff), // Love - green: Color(0x7fb59fff), // ??? (not in Rose Pine?) - yellow: Color(0xf6c177ff), // Gold - blue: Color(0x3e8fb0ff), // Pine - magenta: Color(0xc4a7e7ff), // Iris - cyan: Color(0x9ccfd8ff), // Foam - white: Color(0xe0def4ff), // Text + base: hex(0x232136).with_alpha(BASE_ALPHA), + base_hover: hex(0x2a283e).with_alpha(BASE_HOVER_ALPHA), // Highlight Low + base_active: hex(0x44415a), // Highlight Med + surface: hex(0x2a273f), + overlay: hex(0x393552), + text: hex(0xe0def4), + black: hex(0x6e6a86), // Muted + red: hex(0xeb6f92), // Love + green: hex(0x7fb59f), // ??? (not in Rose Pine?) + yellow: hex(0xf6c177), // Gold + blue: hex(0x3e8fb0), // Pine + magenta: hex(0xc4a7e7), // Iris + cyan: hex(0x9ccfd8), // Foam + white: hex(0xe0def4), // Text }; /// [Arctica](https://github.com/sashakoshka/arctica) indexable color theme. pub const ARCTICA: [Color; 24] = [ - Color(0x242933ff), - Color(0x2e3440ff), - Color(0x3b4252ff), - Color(0x4c566aff), - Color(0xeceff4ff), - Color(0xd8dee9ff), - Color(0xc2c9d6ff), - Color(0xaeb7c6ff), - Color(0xa8555dff), - Color(0xb77763ff), - Color(0xcdb179ff), - Color(0x8ba277ff), - Color(0x769b9bff), - Color(0x72a1aeff), - Color(0x5e81acff), - Color(0x92738cff), - Color(0xbf616aff), - Color(0xd08770ff), - Color(0xebcb8bff), - Color(0xa3be8cff), - Color(0x8fbcbbff), - Color(0x88c0d0ff), - Color(0x81a1c1ff), - Color(0xb48eadff), + hex(0x242933), + hex(0x2e3440), + hex(0x3b4252), + hex(0x4c566a), + hex(0xeceff4), + hex(0xd8dee9), + hex(0xc2c9d6), + hex(0xaeb7c6), + hex(0xa8555d), + hex(0xb77763), + hex(0xcdb179), + hex(0x8ba277), + hex(0x769b9b), + hex(0x72a1ae), + hex(0x5e81ac), + hex(0x92738c), + hex(0xbf616a), + hex(0xd08770), + hex(0xebcb8b), + hex(0xa3be8c), + hex(0x8fbcbb), + hex(0x88c0d0), + hex(0x81a1c1), + hex(0xb48ead), ]; /// [Arctica](https://github.com/sashakoshka/arctica) color palette.