color schemes: remove : splitting for prefix extraction

Originally I had names like `base 16:foo` but wanted `foo` to
sort with `f` rather than `b`, so this prefix extraction
handled that.

I later changed the names to be `foo (base 16)` so we don't
need this.

This moves the `X::Erosion` scheme to sort under `x` where it
feels more natural.

Ensure that scheme_data.rs has a deterministic sort order that
matches the json data.
This commit is contained in:
Wez Furlong committed 2022-07-14 07:40:50 -07:00
1 parent 49e3fd4c9e
commit 0ce5ddbb13
3 files changed
+717 -717

No files matched your search

+645 -645
View File
File diff suppressed because it is too large. Load diff
+66 -66
View File
@@ -5532,39 +5532,6 @@
"prefix": "c"
}
},
{
"colors": {
"ansi": [
"#101010",
"#e84f4f",
"#b8d68c",
"#e1aa5d",
"#7dc1cf",
"#9b64fb",
"#6d878d",
"#dddddd"
],
"background": "#151515",
"brights": [
"#404040",
"#d23d3d",
"#a0cf5d",
"#f39d21",
"#4e9fb1",
"#8542ff",
"#42717b",
"#dddddd"
],
"foreground": "#d7d0c7",
"indexed": {}
},
"metadata": {
"author": "crshd",
"name": "X::DotShare (terminal.sexy)",
"origin_url": "https://github.com/stayradiated/terminal.sexy",
"prefix": "d"
}
},
{
"colors": {
"ansi": [
@@ -6980,39 +6947,6 @@
"prefix": "d"
}
},
{
"colors": {
"ansi": [
"#332d29",
"#8c644c",
"#746c48",
"#908a66",
"#646a6d",
"#605655",
"#4b5c5e",
"#504339"
],
"background": "#181512",
"brights": [
"#817267",
"#9f7155",
"#857b52",
"#9c956e",
"#71777a",
"#656565",
"#556d70",
"#9a875f"
],
"foreground": "#bea492",
"indexed": {}
},
"metadata": {
"author": "earsplit",
"name": "X::Erosion (terminal.sexy)",
"origin_url": "https://github.com/stayradiated/terminal.sexy",
"prefix": "e"
}
},
{
"colors": {
"ansi": [
@@ -25516,6 +25450,72 @@
"prefix": "w"
}
},
{
"colors": {
"ansi": [
"#101010",
"#e84f4f",
"#b8d68c",
"#e1aa5d",
"#7dc1cf",
"#9b64fb",
"#6d878d",
"#dddddd"
],
"background": "#151515",
"brights": [
"#404040",
"#d23d3d",
"#a0cf5d",
"#f39d21",
"#4e9fb1",
"#8542ff",
"#42717b",
"#dddddd"
],
"foreground": "#d7d0c7",
"indexed": {}
},
"metadata": {
"author": "crshd",
"name": "X::DotShare (terminal.sexy)",
"origin_url": "https://github.com/stayradiated/terminal.sexy",
"prefix": "x"
}
},
{
"colors": {
"ansi": [
"#332d29",
"#8c644c",
"#746c48",
"#908a66",
"#646a6d",
"#605655",
"#4b5c5e",
"#504339"
],
"background": "#181512",
"brights": [
"#817267",
"#9f7155",
"#857b52",
"#9c956e",
"#71777a",
"#656565",
"#556d70",
"#9a875f"
],
"foreground": "#bea492",
"indexed": {}
},
"metadata": {
"author": "earsplit",
"name": "X::Erosion (terminal.sexy)",
"origin_url": "https://github.com/stayradiated/terminal.sexy",
"prefix": "x"
}
},
{
"colors": {
"ansi": [
+6 -6
View File
@@ -75,9 +75,7 @@ pub async fn fetch_url(url: &str) -> anyhow::Result<Vec<u8>> {
Ok(data)
}
fn make_prefix(s: &str) -> (char, String) {
let fields: Vec<_> = s.splitn(2, ':').collect();
let key = fields.last().unwrap();
fn make_prefix(key: &str) -> (char, String) {
for c in key.chars() {
match c {
'0'..='9' | 'a'..='z' => return (c, key.to_ascii_lowercase()),
@@ -113,12 +111,15 @@ pub const SCHEMES: [(&'static str, &'static str); {count}] = [\n
",
));
for s in &schemeses {
all.push(s);
}
all.sort_by_key(|s| make_prefix(&s.name));
for s in &all {
let name = s.name.escape_default();
let toml = s.to_toml()?;
let toml = toml.escape_default();
code.push_str(&format!("(\"{name}\", \"{toml}\"),\n",));
all.push(s);
}
code.push_str("];\n");
@@ -135,7 +136,6 @@ pub const SCHEMES: [(&'static str, &'static str); {count}] = [\n
// And the data for the docs
all.sort_by_key(|s| make_prefix(&s.name));
let mut doc_data = vec![];
for s in all {
doc_data.push(s.to_json_value()?);