71 lines
2.4 KiB
Rust
71 lines
2.4 KiB
Rust
use iris::prelude::*;
|
|
|
|
/// The shared phone/desktop paint handles. Replacing their paint-table
|
|
/// entries changes the theme without rebuilding widgets or primitives.
|
|
#[derive(Clone)]
|
|
pub struct Theme {
|
|
pub text: PaintId,
|
|
pub code: PaintId,
|
|
pub link: PaintId,
|
|
pub marker: PaintId,
|
|
pub verbatim_surface: PaintId,
|
|
pub table_surface: PaintId,
|
|
pub quote_bar: PaintId,
|
|
pub quote_text: PaintId,
|
|
pub strikethrough: PaintId,
|
|
pub card_surface: PaintId,
|
|
pub group_surface: PaintId,
|
|
pub muted: PaintId,
|
|
pub awaiting: PaintId,
|
|
pub failed: PaintId,
|
|
pub unknown: PaintId,
|
|
pub composer_surface: PaintId,
|
|
pub secondary_text: PaintId,
|
|
pub syntax_keyword: PaintId,
|
|
pub syntax_string: PaintId,
|
|
pub syntax_literal: PaintId,
|
|
pub syntax_comment: PaintId,
|
|
pub syntax_metadata: PaintId,
|
|
pub syntax_punctuation: PaintId,
|
|
pub syntax_mark: PaintId,
|
|
}
|
|
|
|
impl Theme {
|
|
pub fn new(paints: &mut Paints) -> Self {
|
|
Self {
|
|
text: paints.add(srgb(0xCDD6F4)),
|
|
code: paints.add(srgb(0xCDD6F4)),
|
|
link: paints.add(srgb(0x89B4FA)),
|
|
marker: paints.add(srgb(0xB4BEFE)),
|
|
verbatim_surface: paints.add(srgb(0x11111B)),
|
|
table_surface: paints.add(srgb(0x313244)),
|
|
quote_bar: paints.add(srgb(0x585B70)),
|
|
quote_text: paints.add(srgb(0xA6ADC8)),
|
|
strikethrough: paints.add(srgb(0x6C7086)),
|
|
card_surface: paints.add(srgb(0x313244)),
|
|
group_surface: paints.add(srgb(0x181825)),
|
|
muted: paints.add(srgb(0xA6ADC8)),
|
|
awaiting: paints.add(srgb(0xFAB387)),
|
|
failed: paints.add(srgb(0xF38BA8)),
|
|
unknown: paints.add(srgb(0xF9E2AF)),
|
|
composer_surface: paints.add(Srgba8::rgb(40, 40, 46)),
|
|
secondary_text: paints.add(Srgba8::rgb(150, 150, 160)),
|
|
syntax_keyword: paints.add(srgb(0xCBA6F7)),
|
|
syntax_string: paints.add(srgb(0xA6E3A1)),
|
|
syntax_literal: paints.add(srgb(0xFAB387)),
|
|
syntax_comment: paints.add(srgb(0x6C7086)),
|
|
syntax_metadata: paints.add(srgb(0xF9E2AF)),
|
|
syntax_punctuation: paints.add(srgb(0xA6ADC8)),
|
|
syntax_mark: paints.add(srgb(0x89DCEB)),
|
|
}
|
|
}
|
|
}
|
|
|
|
const fn srgb(hex: u32) -> Srgba8 {
|
|
Srgba8::rgb(
|
|
((hex >> 16) & 0xff) as u8,
|
|
((hex >> 8) & 0xff) as u8,
|
|
(hex & 0xff) as u8,
|
|
)
|
|
}
|