canary-rs/scripts/sao-ui/src/style.rs

93 lines
2.5 KiB
Rust
Raw Normal View History

2022-11-18 21:00:16 +00:00
use canary_script::Color;
2022-11-18 19:43:23 +00:00
/// A reusable set of colors. Used by default widget styles.
pub struct Palette {
pub base: Color,
2022-11-18 21:00:16 +00:00
pub base_hover: Color,
pub base_active: Color,
2022-11-18 19:43:23 +00:00
pub surface: Color,
pub overlay: Color,
pub text: Color,
2022-11-18 20:15:22 +00:00
pub black: Color,
pub red: Color,
pub green: Color,
pub yellow: Color,
pub blue: Color,
pub magenta: Color,
pub cyan: Color,
pub white: Color,
2022-11-18 19:43:23 +00:00
}
/// Sword Art Online color palette.
pub const SAO_PALETTE: Palette = Palette {
2022-11-19 00:00:47 +00:00
base: Color::WHITE.with_alpha(0xc0),
base_hover: Color::WHITE.with_alpha(0xe0),
2022-11-18 21:00:16 +00:00
base_active: Color::YELLOW,
2022-11-18 19:43:23 +00:00
surface: Color::WHITE,
overlay: Color::WHITE,
text: Color::BLACK,
2022-11-18 20:15:22 +00:00
black: Color::BLACK,
red: Color::RED,
green: Color::GREEN,
yellow: Color::YELLOW,
blue: Color::BLUE,
magenta: Color::MAGENTA,
cyan: Color::CYAN,
white: Color::WHITE,
2022-11-18 19:43:23 +00:00
};
/// Rose Pine color palette.
pub const ROSE_PINE_PALETTE: Palette = Palette {
2022-11-19 00:00:47 +00:00
base: Color(0x191724c0),
base_hover: Color(0x21202ee0), // Highlight Low
2022-11-18 21:13:50 +00:00
base_active: Color(0x403d52ff), // Highlight Med
2022-11-18 19:43:23 +00:00
surface: Color(0x1f1d2eff),
overlay: Color(0x26233aff),
text: Color(0xe0def4ff),
2022-11-18 21:13:50 +00:00
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
};
/// Rose Pine Moon color palette.
pub const ROSE_PINE_MOON_PALETTE: Palette = Palette {
2022-11-19 00:00:47 +00:00
base: Color(0x232136c0),
base_hover: Color(0x2a283ee0), // Highlight Low
2022-11-18 21:13:50 +00:00
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
2022-11-18 19:43:23 +00:00
};
2022-11-18 20:08:01 +00:00
/// Common measurements for widget shapes.
pub struct Metrics {
pub surface_rounding: f32,
}
/// Common default parameters for widget styles.
pub struct Theme {
pub palette: Palette,
pub metrics: Metrics,
}
/// The global theme.
pub const THEME: Theme = Theme {
2022-11-18 21:13:50 +00:00
palette: ROSE_PINE_MOON_PALETTE,
2022-11-18 20:08:01 +00:00
metrics: Metrics {
surface_rounding: 5.0,
},
};