Rebrand Zeron theme family as Coop

This commit is contained in:
2026-10-08 09:58:23 +07:00
parent 4dfc9fd668
commit f54f5f35a8
6 changed files with 29 additions and 369 deletions
-1
View File
@@ -1 +0,0 @@
../../LICENSE
-13
View File
@@ -1,13 +0,0 @@
# theme
Theme model and runtime for coop.
The domain model, built-in theme families, and registry design are ported from
[zeron/theme](https://github.com/zeronsh/zeron/tree/main/crates/theme) (MIT licensed),
ported at revision `916cb1ccb1342c2061963a5f6ecf5c977ba46f2c`. The original
gpui-integrated implementation this crate replaced was based on
[zed/theme](https://github.com/zed-industries/zed/tree/main/crates/theme)
(AGPL/GPL, see LICENSE-GPL in the zed repository).
CREDITS: [zeron/theme](https://github.com/zeronsh/zeron/tree/main/crates/theme),
[zed/theme](https://github.com/zed-industries/zed/tree/main/crates/theme)
+16 -19
View File
@@ -12,7 +12,7 @@ pub fn builtin_registry() -> &'static ThemeRegistry {
static REGISTRY: OnceLock<ThemeRegistry> = OnceLock::new();
REGISTRY.get_or_init(|| ThemeRegistry {
families: vec![
family("zeron", "Zeron", vec![zeron_light(), zeron_dark()]),
family("coop", "Coop", vec![coop_light(), coop_dark()]),
family("dracula", "Dracula", vec![dracula()]),
family("github", "GitHub", vec![github_light(), github_dark()]),
family("ayu", "Ayu", vec![ayu_light(), ayu_dark(), ayu_mirage()]),
@@ -119,7 +119,7 @@ fn variant(seed: Seeds<'_>) -> ThemeVariant {
raised,
card,
dialog: card.mix(raised, if dark { 0.18 } else { 0.04 }),
overlay: card.mix(raised, if dark { 0.34 } else { 0.02 }),
overlay: Color::BLACK.with_alpha(if dark { 0.5 } else { 0.3 }),
hover: border_tone.with_alpha(if dark { 0.11 } else { 0.06 }),
active: accent.primary.with_alpha(if dark { 0.18 } else { 0.10 }),
border: border_tone.with_alpha(if dark { 0.10 } else { 0.12 }),
@@ -159,9 +159,6 @@ fn variant(seed: Seeds<'_>) -> ThemeVariant {
},
source: seed.source,
};
// Hash the checked-in resolved definition itself (with the hash field
// blanked), not merely its source URL. This makes provenance sensitive to
// curation edits as well as upstream revision changes.
variant.source.asset_hash.clear();
let encoded = serde_json::to_vec(&variant).expect("built-in theme serializes");
variant.source.asset_hash = format!("sha256:{:x}", Sha256::digest(encoded));
@@ -236,11 +233,11 @@ const ANSI_LIGHT: [&str; 16] = [
"#71717a", "#b91c1c", "#15803d", "#92400e", "#1d4ed8", "#7e22ce", "#155e75", "#18181b",
];
fn zeron_dark() -> ThemeVariant {
fn coop_dark() -> ThemeVariant {
variant(Seeds {
id: "zeron-dark",
family_id: "zeron",
name: "Zeron Dark",
id: "coop-dark",
family_id: "coop",
name: "Coop Dark",
appearance: Appearance::Dark,
treatment: SurfaceTreatment::Frosted,
background: "#060606",
@@ -250,7 +247,7 @@ fn zeron_dark() -> ThemeVariant {
text: "#e8e8ea",
muted: "#a9a9ae",
faint: "#85858a",
accent: "#8b7cf6",
accent: "#FFE629",
danger: "#f87171",
warning: "#facc15",
success: "#34d399",
@@ -261,20 +258,20 @@ fn zeron_dark() -> ThemeVariant {
"#a1a1aa", "#f472b6", "#22d3ee", "#f87171",
],
source: source(
"zeron-dark",
"coop-dark",
"native",
"https://github.com/zeronsh/comet",
"https://git.reya.info/reya/coop",
"d138049",
"MIT",
),
})
}
fn zeron_light() -> ThemeVariant {
fn coop_light() -> ThemeVariant {
variant(Seeds {
id: "zeron-light",
family_id: "zeron",
name: "Zeron Light",
id: "coop-light",
family_id: "coop",
name: "Coop Light",
appearance: Appearance::Light,
treatment: SurfaceTreatment::Frosted,
background: "#ffffff",
@@ -284,7 +281,7 @@ fn zeron_light() -> ThemeVariant {
text: "#303035",
muted: "#62626a",
faint: "#797981",
accent: "#5b43e8",
accent: "#a19200",
danger: "#dc2626",
warning: "#a16207",
success: "#15803d",
@@ -295,9 +292,9 @@ fn zeron_light() -> ThemeVariant {
"#52525b", "#be185d", "#0e7490", "#b91c1c",
],
source: source(
"zeron-light",
"coop-light",
"native",
"https://github.com/zeronsh/comet",
"https://git.reya.info/reya/coop",
"d138049",
"MIT",
),
+12 -11
View File
@@ -240,7 +240,8 @@ pub struct ColorParseError;
#[serde(rename_all = "camelCase")]
pub enum AccentPreset {
#[default]
Zeron,
#[serde(alias = "coop")]
Coop,
Orange,
Amber,
Green,
@@ -251,7 +252,7 @@ pub enum AccentPreset {
impl AccentPreset {
pub const ALL: [Self; 7] = [
Self::Zeron,
Self::Coop,
Self::Orange,
Self::Amber,
Self::Green,
@@ -262,7 +263,7 @@ impl AccentPreset {
pub fn label(self) -> &'static str {
match self {
Self::Zeron => "Zeron",
Self::Coop => "Coop",
Self::Orange => "Orange",
Self::Amber => "Amber",
Self::Green => "Green",
@@ -274,7 +275,7 @@ impl AccentPreset {
pub fn color(self, appearance: Appearance) -> Color {
let (dark, light) = match self {
Self::Zeron => ("#8b7cf6", "#5b43e8"),
Self::Coop => ("#FFE629", "#a19200"),
Self::Orange => ("#fb923c", "#c2410c"),
Self::Amber => ("#fbbf24", "#a16207"),
Self::Green => ("#4ade80", "#15803d"),
@@ -357,8 +358,8 @@ pub struct ThemeSelection {
impl Default for ThemeSelection {
fn default() -> Self {
Self {
light: "zeron-light".into(),
dark: "zeron-dark".into(),
light: "coop-light".into(),
dark: "coop-dark".into(),
}
}
}
@@ -489,12 +490,12 @@ impl ThemeRegistry {
self.variant(selection.variant_id(appearance))
.or_else(|| {
self.variant(if appearance.is_dark() {
"zeron-dark"
"coop-dark"
} else {
"zeron-light"
"coop-light"
})
})
.expect("the built-in registry always contains both Zeron variants")
.expect("the built-in registry always contains both Coop variants")
}
pub fn validate(&self) -> Vec<ValidationIssue> {
@@ -711,8 +712,8 @@ mod tests {
.sum::<usize>(),
30
);
assert!(registry.variant("zeron-light").is_some());
assert!(registry.variant("zeron-dark").is_some());
assert!(registry.variant("coop-light").is_some());
assert!(registry.variant("coop-dark").is_some());
let errors: Vec<_> = registry
.validate()
.into_iter()
+1 -1
View File
@@ -341,7 +341,7 @@ impl RenderOnce for Dialog {
.id(layer_ix)
.bg(cx.theme().background)
.border_1()
.border_color(cx.theme().border.alpha(0.4))
.border_color(cx.theme().border)
.rounded(radius)
.when(cx.theme().shadow, |this| this.shadow_xl())
.min_h_24()