From 7f35aac7a96c645b6537c49492b679f7ec4e9a2e Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 4 May 2024 22:01:00 -0700 Subject: [PATCH] sync-color-schemes: fix mis-parse of color schemes Double check that what we got looked enough like our data when reading from a toml file --- ci/generate-docs.py | 2 ++ config/src/color.rs | 8 ++++++-- config/src/scheme_data.rs | 3 +-- docs/changelog.md | 2 +- docs/colorschemes/data.json | 20 -------------------- sync-color-schemes/src/main.rs | 3 +++ 6 files changed, 13 insertions(+), 25 deletions(-) diff --git a/ci/generate-docs.py b/ci/generate-docs.py index a30c237ec..c69eb9587 100644 --- a/ci/generate-docs.py +++ b/ci/generate-docs.py @@ -79,6 +79,8 @@ def load_scheme(scheme): "[^a-z0-9_]", "_", scheme["metadata"]["name"].lower().replace("+", "plus") ) + if "ansi" not in scheme["colors"]: + raise Exception(f"scheme {scheme} is missing ansi colors!!?") colors = scheme["colors"]["ansi"] + scheme["colors"]["brights"] data = { diff --git a/config/src/color.rs b/config/src/color.rs index 306b88db8..14f3b1c0c 100644 --- a/config/src/color.rs +++ b/config/src/color.rs @@ -728,8 +728,12 @@ fn dynamic_to_toml(value: Value) -> anyhow::Result { impl ColorSchemeFile { pub fn from_toml_value(value: &toml::Value) -> anyhow::Result { - Self::from_dynamic(&crate::toml_to_dynamic(value), Default::default()) - .map_err(|e| anyhow::anyhow!("{}", e)) + let scheme = Self::from_dynamic(&crate::toml_to_dynamic(value), Default::default()) + .map_err(|e| anyhow::anyhow!("{}", e))?; + + anyhow::ensure!(scheme.colors.ansi.is_some(), "scheme is missing ANSI colors"); + + Ok(scheme) } pub fn from_toml_str(s: &str) -> anyhow::Result { diff --git a/config/src/scheme_data.rs b/config/src/scheme_data.rs index 20afb2738..d6e3df9c9 100644 --- a/config/src/scheme_data.rs +++ b/config/src/scheme_data.rs @@ -1,6 +1,6 @@ //! This file was generated by sync-color-schemes -pub const SCHEMES: [(&'static str, &'static str); 994] = [ +pub const SCHEMES: [(&'static str, &'static str); 993] = [ // Start here ("3024 (base16)", "[colors]\nansi = [\n \"#090300\",\n \"#db2d20\",\n \"#01a252\",\n \"#fded02\",\n \"#01a0e4\",\n \"#a16a94\",\n \"#b5e4f4\",\n \"#a5a2a2\",\n]\nbackground = \"#090300\"\nbrights = [\n \"#5c5855\",\n \"#db2d20\",\n \"#01a252\",\n \"#fded02\",\n \"#01a0e4\",\n \"#a16a94\",\n \"#b5e4f4\",\n \"#f7f7f7\",\n]\ncursor_bg = \"#a5a2a2\"\ncursor_border = \"#a5a2a2\"\ncursor_fg = \"#090300\"\nforeground = \"#a5a2a2\"\nselection_bg = \"#a5a2a2\"\nselection_fg = \"#090300\"\n\n[colors.indexed]\n16 = \"#e8bbd0\"\n17 = \"#cdab53\"\n18 = \"#3a3432\"\n19 = \"#4a4543\"\n20 = \"#807d7c\"\n21 = \"#d6d5d4\"\n\n[metadata]\naliases = [\"3024 (dark) (terminal.sexy)\"]\nauthor = \"Jan T. Sott (http://github.com/idleberg)\"\nname = \"3024 (base16)\"\norigin_url = \"https://github.com/chriskempson/base16-unclaimed-schemes\"\nwezterm_version = \"20220807-113146-c2fee766\"\n"), @@ -21,7 +21,6 @@ pub const SCHEMES: [(&'static str, &'static str); 994] = [ ("Afterglow (Gogh)", "[colors]\nansi = [\n \"#151515\",\n \"#a53c23\",\n \"#7b9246\",\n \"#d3a04d\",\n \"#6c99bb\",\n \"#9f4e85\",\n \"#7dd6cf\",\n \"#d0d0d0\",\n]\nbackground = \"#222222\"\nbrights = [\n \"#505050\",\n \"#a53c23\",\n \"#7b9246\",\n \"#d3a04d\",\n \"#547c99\",\n \"#9f4e85\",\n \"#7dd6cf\",\n \"#f5f5f5\",\n]\ncursor_bg = \"#d0d0d0\"\ncursor_border = \"#d0d0d0\"\ncursor_fg = \"#222222\"\nforeground = \"#d0d0d0\"\n\n[colors.indexed]\n\n[metadata]\naliases = []\nname = \"Afterglow (Gogh)\"\norigin_url = \"https://github.com/Gogh-Co/Gogh\"\nwezterm_version = \"20220807-113146-c2fee766\"\n"), ("aikofog (terminal.sexy)", "[colors]\nansi = [\n \"#757475\",\n \"#936a6f\",\n \"#668462\",\n \"#7f7b62\",\n \"#6e7291\",\n \"#846887\",\n \"#637e7b\",\n \"#9a9a9a\",\n]\nbackground = \"#f1eee9\"\nbrights = [\n \"#4a4a4a\",\n \"#d76572\",\n \"#4fae42\",\n \"#a8981f\",\n \"#7782cf\",\n \"#b754c4\",\n \"#2ea89a\",\n \"#c4c4c4\",\n]\nforeground = \"#b2b3b8\"\n\n[colors.indexed]\n\n[metadata]\naliases = []\nauthor = \"Gutterslob\"\nname = \"aikofog (terminal.sexy)\"\norigin_url = \"https://github.com/stayradiated/terminal.sexy\"\nwezterm_version = \"20220807-113146-c2fee766\"\n"), ("Alabaster", "[colors]\nansi = [\n \"#000000\",\n \"#aa3731\",\n \"#448c27\",\n \"#cb9000\",\n \"#325cc0\",\n \"#7a3e9d\",\n \"#0083b2\",\n \"#f7f7f7\",\n]\nbackground = \"#f7f7f7\"\nbrights = [\n \"#777777\",\n \"#f05050\",\n \"#60cb00\",\n \"#ffbc5d\",\n \"#007acc\",\n \"#e64ce6\",\n \"#00aacb\",\n \"#f7f7f7\",\n]\ncursor_bg = \"#007acc\"\ncursor_border = \"#007acc\"\ncursor_fg = \"#bfdbfe\"\nforeground = \"#000000\"\nselection_bg = \"#bfdbfe\"\nselection_fg = \"#000000\"\n\n[colors.indexed]\n\n[metadata]\naliases = []\nname = \"Alabaster\"\norigin_url = \"https://github.com/mbadolato/iTerm2-Color-Schemes\"\nwezterm_version = \"Always\"\n"), -("alacritty", "[colors.indexed]\n\n[metadata]\naliases = [\n \"bamboo\",\n \"bamboo_light\",\n \"bamboo_multiplex\",\n \"tokyonight_day\",\n \"tokyonight_moon\",\n \"tokyonight_night\",\n \"tokyonight_storm\",\n]\nname = \"alacritty\"\norigin_url = \"https://github.com/EdenEast/nightfox.nvim\"\nwezterm_version = \"nightly builds only\"\n"), ("Alien Blood (Gogh)", "[colors]\nansi = [\n \"#112616\",\n \"#7f2b27\",\n \"#2f7e25\",\n \"#717f24\",\n \"#2f6a7f\",\n \"#47587f\",\n \"#327f77\",\n \"#647d75\",\n]\nbackground = \"#0f1610\"\nbrights = [\n \"#3c4812\",\n \"#e08009\",\n \"#18e000\",\n \"#bde000\",\n \"#00aae0\",\n \"#0058e0\",\n \"#00e0c4\",\n \"#73fa91\",\n]\ncursor_bg = \"#637d75\"\ncursor_border = \"#637d75\"\ncursor_fg = \"#0f1610\"\nforeground = \"#637d75\"\n\n[colors.indexed]\n\n[metadata]\naliases = []\nname = \"Alien Blood (Gogh)\"\norigin_url = \"https://github.com/Gogh-Co/Gogh\"\nwezterm_version = \"20230712-072601-f4abf8fd\"\n"), ("AlienBlood", "[colors]\nansi = [\n \"#112616\",\n \"#7f2b27\",\n \"#2f7e25\",\n \"#717f24\",\n \"#2f6a7f\",\n \"#47587f\",\n \"#327f77\",\n \"#647d75\",\n]\nbackground = \"#0f1610\"\nbrights = [\n \"#3c4812\",\n \"#e08009\",\n \"#18e000\",\n \"#bde000\",\n \"#00aae0\",\n \"#0058e0\",\n \"#00e0c4\",\n \"#73fa91\",\n]\ncursor_bg = \"#73fa91\"\ncursor_border = \"#73fa91\"\ncursor_fg = \"#0f1610\"\nforeground = \"#637d75\"\nselection_bg = \"#1d4125\"\nselection_fg = \"#73fa91\"\n\n[colors.indexed]\n\n[metadata]\naliases = [\"Alien Blood (Gogh)\"]\nname = \"AlienBlood\"\norigin_url = \"https://github.com/mbadolato/iTerm2-Color-Schemes\"\nwezterm_version = \"Always\"\n"), ("Andromeda", "[colors]\nansi = [\n \"#000000\",\n \"#cd3131\",\n \"#05bc79\",\n \"#e5e512\",\n \"#2472c8\",\n \"#bc3fbc\",\n \"#0fa8cd\",\n \"#e5e5e5\",\n]\nbackground = \"#262a33\"\nbrights = [\n \"#666666\",\n \"#cd3131\",\n \"#05bc79\",\n \"#e5e512\",\n \"#2472c8\",\n \"#bc3fbc\",\n \"#0fa8cd\",\n \"#e5e5e5\",\n]\ncursor_bg = \"#f8f8f0\"\ncursor_border = \"#f8f8f0\"\ncursor_fg = \"#cfcfc2\"\nforeground = \"#e5e5e5\"\nselection_bg = \"#5a5c62\"\nselection_fg = \"#ece7e7\"\n\n[colors.indexed]\n\n[metadata]\naliases = []\nname = \"Andromeda\"\norigin_url = \"https://github.com/mbadolato/iTerm2-Color-Schemes\"\nwezterm_version = \"Always\"\n"), diff --git a/docs/changelog.md b/docs/changelog.md index 09a8700e1..92be043cc 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -48,7 +48,7 @@ As features stabilize some brief notes about them will accumulate here. #### Updated * Bundled conpty.dll and OpenConsole.exe to build 1.19.240130002.nupkg -* Color schemes: [alacritty](colorschemes/a/index.md#alacritty), +* Color schemes: [Blue Dolphin (Gogh)](colorschemes/b/index.md#blue-dolphin-gogh), [Butrin (Gogh)](colorschemes/b/index.md#butrin-gogh), [CutiePro](colorschemes/c/index.md#cutiepro), diff --git a/docs/colorschemes/data.json b/docs/colorschemes/data.json index edae6e7d3..31627f2a2 100644 --- a/docs/colorschemes/data.json +++ b/docs/colorschemes/data.json @@ -697,26 +697,6 @@ "wezterm_version": "Always" } }, - { - "colors": { - "indexed": {} - }, - "metadata": { - "aliases": [ - "bamboo", - "bamboo_light", - "bamboo_multiplex", - "tokyonight_day", - "tokyonight_moon", - "tokyonight_night", - "tokyonight_storm" - ], - "name": "alacritty", - "origin_url": "https://github.com/EdenEast/nightfox.nvim", - "prefix": "a", - "wezterm_version": "nightly builds only" - } - }, { "colors": { "ansi": [ diff --git a/sync-color-schemes/src/main.rs b/sync-color-schemes/src/main.rs index 901ad7b6c..018451198 100644 --- a/sync-color-schemes/src/main.rs +++ b/sync-color-schemes/src/main.rs @@ -242,6 +242,9 @@ impl SchemeSet { let existing: Vec = serde_json::from_str(&data)?; for item in existing { let data = ColorSchemeFile::from_json_value(&item)?; + if data.colors.ansi.is_none() { + continue; + } let name = data.metadata.name.as_ref().unwrap().to_string(); by_name.insert( name.to_string(),