This commit is contained in:
2026-10-08 08:42:44 +07:00
parent 069f031af9
commit 2efb6ac5ca
24 changed files with 628 additions and 2614 deletions
+2 -17
View File
@@ -1,7 +1,3 @@
// Ported from zeronsh/zeron crates/theme/src/lib.rs
// at revision 916cb1ccb1342c2061963a5f6ecf5c977ba46f2c (MIT).
// The custom theme library and VS Code import modules are out of scope for now
// and will be ported in a later phase.
#![allow(dead_code)]
use std::collections::{BTreeMap, HashSet};
@@ -19,10 +15,6 @@ fn custom_families() -> &'static RwLock<Vec<ThemeFamily>> {
}
/// Replace the process-wide custom portion of the runtime registry.
///
/// The UI calls this after loading or mutating the durable theme library. The
/// returned registry remains source-neutral: renderers still see only resolved
/// families and variants.
pub fn replace_custom_families(families: Vec<ThemeFamily>) {
*custom_families()
.write()
@@ -53,8 +45,6 @@ pub enum SurfaceTreatment {
Frosted,
}
/// The device-local policy applied to a theme variant's recommended surface
/// treatment. This is deliberately independent from theme and accent choices.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SurfacePreference {
@@ -474,8 +464,7 @@ pub struct ThemeVariant {
pub family_id: String,
pub name: String,
pub appearance: Appearance,
/// The author's recommended treatment. Runtime applies the user's
/// [`SurfacePreference`] before components consume the variant.
/// The author's recommended treatment.
#[serde(alias = "surfaceTreatment")]
pub recommended_surface_treatment: SurfaceTreatment,
pub colors: ThemeColors,
@@ -617,9 +606,7 @@ impl ThemeRegistry {
));
}
for (index, color) in variant.terminal.ansi.iter().enumerate() {
// Slots 0 and 8 are structural black/dim colors. Every
// chromatic normal and bright slot is expected to remain
// distinguishable as terminal text.
// Slots 0 and 8 are structural black/dim colors.
if index % 8 == 0 {
continue;
}
@@ -660,8 +647,6 @@ pub enum ValidationSeverity {
Error,
}
/// Whether a validation issue makes a theme structurally unsafe to install or
/// describes a visual quality problem that the compiler/runtime can harden.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValidationCategory {