build: use the masi/craft-libs fork; take the Catppuccin palette from craft-ui
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Generated
+1
-1
@@ -1075,7 +1075,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=5c874d51eeb3de70e735c8ce87a59a7dedd47675#5c874d51eeb3de70e735c8ce87a59a7dedd47675"
|
||||
source = "git+https://git.marcospaulo.dev.br/masi/craft-libs?rev=22544b6d619d4f16779b8bdfa3f0b642a86fc065#22544b6d619d4f16779b8bdfa3f0b642a86fc065"
|
||||
dependencies = [
|
||||
"egui",
|
||||
"serde",
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ rust-version = "1.90"
|
||||
repository = "https://github.com/storytold/lightcraft"
|
||||
|
||||
[workspace.dependencies]
|
||||
craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "5c874d51eeb3de70e735c8ce87a59a7dedd47675", features = ["serde"] }
|
||||
craft-ui = { git = "https://git.marcospaulo.dev.br/masi/craft-libs", rev = "22544b6d619d4f16779b8bdfa3f0b642a86fc065", features = ["serde"] }
|
||||
# internal
|
||||
lightcraft-denoise-core = { path = "crates/denoise-core" }
|
||||
lightcraft-denoise = { path = "crates/denoise", default-features = false }
|
||||
|
||||
@@ -1,132 +1,52 @@
|
||||
//! Catppuccin Latte, Frappé, Macchiato and Mocha. Palette: the Catppuccin project's colours
|
||||
//! (https://catppuccin.com/palette, MIT; see LICENSE-catppuccin.txt), accent Mauve.
|
||||
|
||||
use craft_ui::theme::catppuccin::Flavor;
|
||||
use egui::Color32;
|
||||
|
||||
use crate::theme::{ThemeKind, Tokens};
|
||||
|
||||
/// The Catppuccin colours these themes use, as 0xRRGGBB.
|
||||
struct Palette {
|
||||
text: u32,
|
||||
subtext1: u32,
|
||||
subtext0: u32,
|
||||
overlay1: u32,
|
||||
overlay0: u32,
|
||||
surface1: u32,
|
||||
surface0: u32,
|
||||
base: u32,
|
||||
mantle: u32,
|
||||
crust: u32,
|
||||
mauve: u32,
|
||||
red: u32,
|
||||
yellow: u32,
|
||||
}
|
||||
|
||||
const LATTE: Palette = Palette {
|
||||
text: 0x4c4f69,
|
||||
subtext1: 0x5c5f77,
|
||||
subtext0: 0x6c6f85,
|
||||
overlay1: 0x8c8fa1,
|
||||
overlay0: 0x9ca0b0,
|
||||
surface1: 0xbcc0cc,
|
||||
surface0: 0xccd0da,
|
||||
base: 0xeff1f5,
|
||||
mantle: 0xe6e9ef,
|
||||
crust: 0xdce0e8,
|
||||
mauve: 0x8839ef,
|
||||
red: 0xd20f39,
|
||||
yellow: 0xdf8e1d,
|
||||
};
|
||||
const FRAPPE: Palette = Palette {
|
||||
text: 0xc6d0f5,
|
||||
subtext1: 0xb5bfe2,
|
||||
subtext0: 0xa5adce,
|
||||
overlay1: 0x838ba7,
|
||||
overlay0: 0x737994,
|
||||
surface1: 0x51576d,
|
||||
surface0: 0x414559,
|
||||
base: 0x303446,
|
||||
mantle: 0x292c3c,
|
||||
crust: 0x232634,
|
||||
mauve: 0xca9ee6,
|
||||
red: 0xe78284,
|
||||
yellow: 0xe5c890,
|
||||
};
|
||||
const MACCHIATO: Palette = Palette {
|
||||
text: 0xcad3f5,
|
||||
subtext1: 0xb8c0e0,
|
||||
subtext0: 0xa5adcb,
|
||||
overlay1: 0x8087a2,
|
||||
overlay0: 0x6e738d,
|
||||
surface1: 0x494d64,
|
||||
surface0: 0x363a4f,
|
||||
base: 0x24273a,
|
||||
mantle: 0x1e2030,
|
||||
crust: 0x181926,
|
||||
mauve: 0xc6a0f6,
|
||||
red: 0xed8796,
|
||||
yellow: 0xeed49f,
|
||||
};
|
||||
const MOCHA: Palette = Palette {
|
||||
text: 0xcdd6f4,
|
||||
subtext1: 0xbac2de,
|
||||
subtext0: 0xa6adc8,
|
||||
overlay1: 0x7f849c,
|
||||
overlay0: 0x6c7086,
|
||||
surface1: 0x45475a,
|
||||
surface0: 0x313244,
|
||||
base: 0x1e1e2e,
|
||||
mantle: 0x181825,
|
||||
crust: 0x11111b,
|
||||
mauve: 0xcba6f7,
|
||||
red: 0xf38ba8,
|
||||
yellow: 0xf9e2af,
|
||||
};
|
||||
|
||||
fn c(rgb: u32) -> Color32 {
|
||||
Color32::from_rgb((rgb >> 16) as u8, (rgb >> 8) as u8, rgb as u8)
|
||||
}
|
||||
|
||||
/// Tokens for a Catppuccin kind, on top of `base` (which supplies the metrics). Any other kind
|
||||
/// falls back to Mocha (never reached: `for_kind` only routes these four here).
|
||||
pub(crate) fn tokens(kind: ThemeKind, base: Tokens) -> Tokens {
|
||||
let (p, light) = match kind {
|
||||
ThemeKind::CatppuccinLatte => (&LATTE, true),
|
||||
ThemeKind::CatppuccinFrappe => (&FRAPPE, false),
|
||||
ThemeKind::CatppuccinMacchiato => (&MACCHIATO, false),
|
||||
_ => (&MOCHA, false),
|
||||
let f = match kind {
|
||||
ThemeKind::CatppuccinLatte => Flavor::Latte,
|
||||
ThemeKind::CatppuccinFrappe => Flavor::Frappe,
|
||||
ThemeKind::CatppuccinMacchiato => Flavor::Macchiato,
|
||||
_ => Flavor::Mocha,
|
||||
};
|
||||
let (p, light) = (f.palette(), !f.is_dark());
|
||||
// Dark flavours: the photo area is the darkest step; Latte: the chrome is the lightest.
|
||||
let (chrome, canvas, grid_bg, divider, field) =
|
||||
if light { (p.mantle, p.crust, p.base, p.surface0, p.base) } else { (p.base, p.mantle, p.crust, p.crust, p.crust) };
|
||||
Tokens {
|
||||
chrome: c(chrome),
|
||||
canvas: c(canvas),
|
||||
grid_bg: c(grid_bg),
|
||||
cell: c(canvas),
|
||||
cell_selected: c(if light { p.surface1 } else { p.surface0 }),
|
||||
divider: c(divider),
|
||||
inset: c(if light { p.crust } else { p.mantle }),
|
||||
field: c(field),
|
||||
field_border: c(p.surface1),
|
||||
button: c(if light { p.base } else { p.mantle }),
|
||||
button_border: c(p.surface1),
|
||||
hover: c(p.surface0),
|
||||
pressed: c(p.surface1),
|
||||
tool_active: c(p.surface1),
|
||||
text: c(p.text),
|
||||
text_label: c(p.subtext1),
|
||||
text_dim: c(p.subtext0),
|
||||
text_disabled: c(p.overlay0),
|
||||
icon: c(p.subtext0),
|
||||
track: c(p.surface1),
|
||||
thumb: c(p.overlay1),
|
||||
thumb_hover: c(p.text),
|
||||
accent: c(p.mauve),
|
||||
star: c(p.text),
|
||||
pick: c(p.text),
|
||||
reject: c(p.red),
|
||||
caution: c(p.yellow),
|
||||
chrome,
|
||||
canvas,
|
||||
grid_bg,
|
||||
cell: canvas,
|
||||
cell_selected: if light { p.surface1 } else { p.surface0 },
|
||||
divider,
|
||||
inset: if light { p.crust } else { p.mantle },
|
||||
field,
|
||||
field_border: p.surface1,
|
||||
button: if light { p.base } else { p.mantle },
|
||||
button_border: p.surface1,
|
||||
hover: p.surface0,
|
||||
pressed: p.surface1,
|
||||
tool_active: p.surface1,
|
||||
text: p.text,
|
||||
text_label: p.subtext1,
|
||||
text_dim: p.subtext0,
|
||||
text_disabled: p.overlay0,
|
||||
icon: p.subtext0,
|
||||
track: p.surface1,
|
||||
thumb: p.overlay1,
|
||||
thumb_hover: p.text,
|
||||
accent: p.mauve,
|
||||
star: p.text,
|
||||
pick: p.text,
|
||||
reject: p.red,
|
||||
caution: p.yellow,
|
||||
..base
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user