Files
qbz/crates/qbz-theme/Cargo.toml
T
vicrodh 95fed0a27c feat(theme): custom-theme base tokens + derivation in qbz-theme
Add crates/qbz-theme/src/custom.rs: the extended port of the Tauri "edit
theme colors" feature. A CustomThemeBase of 12 hand-picked semantic tokens
(surfaces, text, accent, status hues, border, favorite + is_dark polarity),
stored as opaque #rrggbb hex strings, derives the full ThemeColors contract.

Unlike Tauri (8 raw vars, no derivation, over the auto-theme only), editing a
base token now cascades: theme_from_base derives the accent triplet
(+0.10/-0.10 lightness, contrast-picked accent_text), the danger/warning/
success families (0.1/0.3 tints, polarity hover), muted/disabled text tiers,
border_strong, the translucent edges and the polarity alpha ramp.

Reuses the existing math instead of duplicating it: generator::{tint,
pick_btn_text_for_accent_set, ensure_text_contrast_target} are now pub(crate);
PaletteColor::shift_lightness and alpha_ramp are shared as-is. base_from_theme
is the inverse seed ("Start from current theme") and round-trips exactly for
any theme this module authored. Adds Rgba::to_hex. 9 unit tests (roundtrip,
polarity, determinism, accent-text legibility, malformed-hex fallback, JSON).

cc
2026-07-06 10:03:01 -06:00

24 lines
1.1 KiB
TOML

[package]
name = "qbz-theme"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
description = "Frontend-agnostic theme/palette registry for QBZ (ADR-006). No Slint, no Tauri, no heavy deps."
[dependencies]
# Serde — for persisting/parsing the stable theme slug and the auto-theme
# palette/scheme types. All color + contrast math is hand-rolled so the core
# stays light and fast.
serde = { workspace = true }
# Image decoding for the auto-theme palette extractor (`auto::palette`). Only the
# formats a wallpaper / user cover realistically uses are enabled, so the codec
# surface stays small and `cargo check -p qbz-theme` remains fast. Version
# matches the one already resolved in crates/Cargo.lock (0.25.x).
image = { version = "0.25", default-features = false, features = ["jpeg", "png", "webp", "bmp", "tiff"] }
[dev-dependencies]
# JSON round-trip test for the custom-theme base (the bin persists it to
# custom_theme.json via serde_json; the crate itself only needs serde derive).
serde_json = { workspace = true }