1
1
mirror of https://github.com/wez/wezterm.git synced 2024-07-14 17:40:26 +03:00

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
This commit is contained in:
Wez Furlong 2024-05-04 22:01:00 -07:00
parent f01397ead3
commit 7f35aac7a9
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
6 changed files with 13 additions and 25 deletions

View File

@ -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 = {

View File

@ -728,8 +728,12 @@ fn dynamic_to_toml(value: Value) -> anyhow::Result<toml::Value> {
impl ColorSchemeFile {
pub fn from_toml_value(value: &toml::Value) -> anyhow::Result<Self> {
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<Self> {

View File

@ -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"),

View File

@ -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),

View File

@ -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": [

View File

@ -242,6 +242,9 @@ impl SchemeSet {
let existing: Vec<serde_json::Value> = 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(),