Merge branch 'main' into n/t2
This commit is contained in:
commit
115bd65344
2 changed files with 147 additions and 93 deletions
|
@ -1,9 +1,12 @@
|
||||||
use gpui2::{hsla, Rgba};
|
use std::num::ParseIntError;
|
||||||
|
|
||||||
|
use gpui2::{hsla, Hsla, Rgba};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
colors::{GitStatusColors, PlayerColor, PlayerColors, StatusColors, SystemColors, ThemeColors},
|
colors::{GitStatusColors, PlayerColor, PlayerColors, StatusColors, SystemColors, ThemeColors},
|
||||||
scale::{ColorScaleSet, ColorScales},
|
scale::{ColorScaleSet, ColorScales},
|
||||||
syntax::SyntaxTheme,
|
syntax::SyntaxTheme,
|
||||||
|
ColorScale,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn neutral() -> ColorScaleSet {
|
fn neutral() -> ColorScaleSet {
|
||||||
|
@ -265,31 +268,35 @@ impl ThemeColors {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DefaultColorScaleSet {
|
type StaticColorScale = [&'static str; 12];
|
||||||
|
|
||||||
|
struct StaticColorScaleSet {
|
||||||
scale: &'static str,
|
scale: &'static str,
|
||||||
light: [&'static str; 12],
|
light: StaticColorScale,
|
||||||
light_alpha: [&'static str; 12],
|
light_alpha: StaticColorScale,
|
||||||
dark: [&'static str; 12],
|
dark: StaticColorScale,
|
||||||
dark_alpha: [&'static str; 12],
|
dark_alpha: StaticColorScale,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<DefaultColorScaleSet> for ColorScaleSet {
|
impl TryFrom<StaticColorScaleSet> for ColorScaleSet {
|
||||||
fn from(default: DefaultColorScaleSet) -> Self {
|
type Error = ParseIntError;
|
||||||
Self::new(
|
|
||||||
default.scale,
|
fn try_from(value: StaticColorScaleSet) -> Result<Self, Self::Error> {
|
||||||
default
|
fn to_color_scale(scale: StaticColorScale) -> Result<ColorScale, ParseIntError> {
|
||||||
.light
|
scale
|
||||||
.map(|color| Rgba::try_from(color).unwrap().into()),
|
.into_iter()
|
||||||
default
|
.map(|color| Rgba::try_from(color).map(Hsla::from))
|
||||||
.light_alpha
|
.collect::<Result<Vec<_>, _>>()
|
||||||
.map(|color| Rgba::try_from(color).unwrap().into()),
|
.map(ColorScale::from_iter)
|
||||||
default
|
}
|
||||||
.dark
|
|
||||||
.map(|color| Rgba::try_from(color).unwrap().into()),
|
Ok(Self::new(
|
||||||
default
|
value.scale,
|
||||||
.dark_alpha
|
to_color_scale(value.light)?,
|
||||||
.map(|color| Rgba::try_from(color).unwrap().into()),
|
to_color_scale(value.light_alpha)?,
|
||||||
)
|
to_color_scale(value.dark)?,
|
||||||
|
to_color_scale(value.dark_alpha)?,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +339,7 @@ pub fn default_color_scales() -> ColorScales {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gray() -> ColorScaleSet {
|
fn gray() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Gray",
|
scale: "Gray",
|
||||||
light: [
|
light: [
|
||||||
"#fcfcfcff",
|
"#fcfcfcff",
|
||||||
|
@ -391,11 +398,12 @@ fn gray() -> ColorScaleSet {
|
||||||
"#ffffffed",
|
"#ffffffed",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mauve() -> ColorScaleSet {
|
fn mauve() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Mauve",
|
scale: "Mauve",
|
||||||
light: [
|
light: [
|
||||||
"#fdfcfdff",
|
"#fdfcfdff",
|
||||||
|
@ -454,11 +462,12 @@ fn mauve() -> ColorScaleSet {
|
||||||
"#fdfdffef",
|
"#fdfdffef",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn slate() -> ColorScaleSet {
|
fn slate() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Slate",
|
scale: "Slate",
|
||||||
light: [
|
light: [
|
||||||
"#fcfcfdff",
|
"#fcfcfdff",
|
||||||
|
@ -517,11 +526,12 @@ fn slate() -> ColorScaleSet {
|
||||||
"#fcfdffef",
|
"#fcfdffef",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sage() -> ColorScaleSet {
|
fn sage() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Sage",
|
scale: "Sage",
|
||||||
light: [
|
light: [
|
||||||
"#fbfdfcff",
|
"#fbfdfcff",
|
||||||
|
@ -580,11 +590,12 @@ fn sage() -> ColorScaleSet {
|
||||||
"#fdfffeed",
|
"#fdfffeed",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn olive() -> ColorScaleSet {
|
fn olive() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Olive",
|
scale: "Olive",
|
||||||
light: [
|
light: [
|
||||||
"#fcfdfcff",
|
"#fcfdfcff",
|
||||||
|
@ -643,11 +654,12 @@ fn olive() -> ColorScaleSet {
|
||||||
"#fdfffded",
|
"#fdfffded",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sand() -> ColorScaleSet {
|
fn sand() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Sand",
|
scale: "Sand",
|
||||||
light: [
|
light: [
|
||||||
"#fdfdfcff",
|
"#fdfdfcff",
|
||||||
|
@ -706,11 +718,12 @@ fn sand() -> ColorScaleSet {
|
||||||
"#fffffded",
|
"#fffffded",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gold() -> ColorScaleSet {
|
fn gold() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Gold",
|
scale: "Gold",
|
||||||
light: [
|
light: [
|
||||||
"#fdfdfcff",
|
"#fdfdfcff",
|
||||||
|
@ -769,11 +782,12 @@ fn gold() -> ColorScaleSet {
|
||||||
"#fef7ede7",
|
"#fef7ede7",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bronze() -> ColorScaleSet {
|
fn bronze() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Bronze",
|
scale: "Bronze",
|
||||||
light: [
|
light: [
|
||||||
"#fdfcfcff",
|
"#fdfcfcff",
|
||||||
|
@ -832,11 +846,12 @@ fn bronze() -> ColorScaleSet {
|
||||||
"#fff1e9ec",
|
"#fff1e9ec",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn brown() -> ColorScaleSet {
|
fn brown() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Brown",
|
scale: "Brown",
|
||||||
light: [
|
light: [
|
||||||
"#fefdfcff",
|
"#fefdfcff",
|
||||||
|
@ -895,11 +910,12 @@ fn brown() -> ColorScaleSet {
|
||||||
"#feecd4f2",
|
"#feecd4f2",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn yellow() -> ColorScaleSet {
|
fn yellow() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Yellow",
|
scale: "Yellow",
|
||||||
light: [
|
light: [
|
||||||
"#fdfdf9ff",
|
"#fdfdf9ff",
|
||||||
|
@ -958,11 +974,12 @@ fn yellow() -> ColorScaleSet {
|
||||||
"#fef6baf6",
|
"#fef6baf6",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn amber() -> ColorScaleSet {
|
fn amber() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Amber",
|
scale: "Amber",
|
||||||
light: [
|
light: [
|
||||||
"#fefdfbff",
|
"#fefdfbff",
|
||||||
|
@ -1021,11 +1038,12 @@ fn amber() -> ColorScaleSet {
|
||||||
"#ffe7b3ff",
|
"#ffe7b3ff",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn orange() -> ColorScaleSet {
|
fn orange() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Orange",
|
scale: "Orange",
|
||||||
light: [
|
light: [
|
||||||
"#fefcfbff",
|
"#fefcfbff",
|
||||||
|
@ -1084,11 +1102,12 @@ fn orange() -> ColorScaleSet {
|
||||||
"#ffe0c2ff",
|
"#ffe0c2ff",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tomato() -> ColorScaleSet {
|
fn tomato() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Tomato",
|
scale: "Tomato",
|
||||||
light: [
|
light: [
|
||||||
"#fffcfcff",
|
"#fffcfcff",
|
||||||
|
@ -1147,11 +1166,12 @@ fn tomato() -> ColorScaleSet {
|
||||||
"#ffd6cefb",
|
"#ffd6cefb",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn red() -> ColorScaleSet {
|
fn red() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Red",
|
scale: "Red",
|
||||||
light: [
|
light: [
|
||||||
"#fffcfcff",
|
"#fffcfcff",
|
||||||
|
@ -1210,11 +1230,12 @@ fn red() -> ColorScaleSet {
|
||||||
"#ffd1d9ff",
|
"#ffd1d9ff",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ruby() -> ColorScaleSet {
|
fn ruby() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Ruby",
|
scale: "Ruby",
|
||||||
light: [
|
light: [
|
||||||
"#fffcfdff",
|
"#fffcfdff",
|
||||||
|
@ -1273,11 +1294,12 @@ fn ruby() -> ColorScaleSet {
|
||||||
"#ffd3e2fe",
|
"#ffd3e2fe",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn crimson() -> ColorScaleSet {
|
fn crimson() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Crimson",
|
scale: "Crimson",
|
||||||
light: [
|
light: [
|
||||||
"#fffcfdff",
|
"#fffcfdff",
|
||||||
|
@ -1336,11 +1358,12 @@ fn crimson() -> ColorScaleSet {
|
||||||
"#ffd5eafd",
|
"#ffd5eafd",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pink() -> ColorScaleSet {
|
fn pink() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Pink",
|
scale: "Pink",
|
||||||
light: [
|
light: [
|
||||||
"#fffcfeff",
|
"#fffcfeff",
|
||||||
|
@ -1399,11 +1422,12 @@ fn pink() -> ColorScaleSet {
|
||||||
"#ffd3ecfd",
|
"#ffd3ecfd",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn plum() -> ColorScaleSet {
|
fn plum() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Plum",
|
scale: "Plum",
|
||||||
light: [
|
light: [
|
||||||
"#fefcffff",
|
"#fefcffff",
|
||||||
|
@ -1462,11 +1486,12 @@ fn plum() -> ColorScaleSet {
|
||||||
"#feddfef4",
|
"#feddfef4",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn purple() -> ColorScaleSet {
|
fn purple() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Purple",
|
scale: "Purple",
|
||||||
light: [
|
light: [
|
||||||
"#fefcfeff",
|
"#fefcfeff",
|
||||||
|
@ -1525,11 +1550,12 @@ fn purple() -> ColorScaleSet {
|
||||||
"#f1ddfffa",
|
"#f1ddfffa",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn violet() -> ColorScaleSet {
|
fn violet() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Violet",
|
scale: "Violet",
|
||||||
light: [
|
light: [
|
||||||
"#fdfcfeff",
|
"#fdfcfeff",
|
||||||
|
@ -1588,11 +1614,12 @@ fn violet() -> ColorScaleSet {
|
||||||
"#e3defffe",
|
"#e3defffe",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn iris() -> ColorScaleSet {
|
fn iris() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Iris",
|
scale: "Iris",
|
||||||
light: [
|
light: [
|
||||||
"#fdfdffff",
|
"#fdfdffff",
|
||||||
|
@ -1651,11 +1678,12 @@ fn iris() -> ColorScaleSet {
|
||||||
"#e1e0fffe",
|
"#e1e0fffe",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn indigo() -> ColorScaleSet {
|
fn indigo() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Indigo",
|
scale: "Indigo",
|
||||||
light: [
|
light: [
|
||||||
"#fdfdfeff",
|
"#fdfdfeff",
|
||||||
|
@ -1714,11 +1742,12 @@ fn indigo() -> ColorScaleSet {
|
||||||
"#d6e1ffff",
|
"#d6e1ffff",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blue() -> ColorScaleSet {
|
fn blue() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Blue",
|
scale: "Blue",
|
||||||
light: [
|
light: [
|
||||||
"#fbfdffff",
|
"#fbfdffff",
|
||||||
|
@ -1777,11 +1806,12 @@ fn blue() -> ColorScaleSet {
|
||||||
"#c2e6ffff",
|
"#c2e6ffff",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cyan() -> ColorScaleSet {
|
fn cyan() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Cyan",
|
scale: "Cyan",
|
||||||
light: [
|
light: [
|
||||||
"#fafdfeff",
|
"#fafdfeff",
|
||||||
|
@ -1840,11 +1870,12 @@ fn cyan() -> ColorScaleSet {
|
||||||
"#bbf3fef7",
|
"#bbf3fef7",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn teal() -> ColorScaleSet {
|
fn teal() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Teal",
|
scale: "Teal",
|
||||||
light: [
|
light: [
|
||||||
"#fafefdff",
|
"#fafefdff",
|
||||||
|
@ -1903,11 +1934,12 @@ fn teal() -> ColorScaleSet {
|
||||||
"#b8ffebef",
|
"#b8ffebef",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn jade() -> ColorScaleSet {
|
fn jade() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Jade",
|
scale: "Jade",
|
||||||
light: [
|
light: [
|
||||||
"#fbfefdff",
|
"#fbfefdff",
|
||||||
|
@ -1966,11 +1998,12 @@ fn jade() -> ColorScaleSet {
|
||||||
"#b8ffe1ef",
|
"#b8ffe1ef",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn green() -> ColorScaleSet {
|
fn green() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Green",
|
scale: "Green",
|
||||||
light: [
|
light: [
|
||||||
"#fbfefcff",
|
"#fbfefcff",
|
||||||
|
@ -2029,11 +2062,12 @@ fn green() -> ColorScaleSet {
|
||||||
"#bbffd7f0",
|
"#bbffd7f0",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn grass() -> ColorScaleSet {
|
fn grass() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Grass",
|
scale: "Grass",
|
||||||
light: [
|
light: [
|
||||||
"#fbfefbff",
|
"#fbfefbff",
|
||||||
|
@ -2092,11 +2126,12 @@ fn grass() -> ColorScaleSet {
|
||||||
"#ceffceef",
|
"#ceffceef",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lime() -> ColorScaleSet {
|
fn lime() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Lime",
|
scale: "Lime",
|
||||||
light: [
|
light: [
|
||||||
"#fcfdfaff",
|
"#fcfdfaff",
|
||||||
|
@ -2155,11 +2190,12 @@ fn lime() -> ColorScaleSet {
|
||||||
"#e9febff7",
|
"#e9febff7",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mint() -> ColorScaleSet {
|
fn mint() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Mint",
|
scale: "Mint",
|
||||||
light: [
|
light: [
|
||||||
"#f9fefdff",
|
"#f9fefdff",
|
||||||
|
@ -2218,11 +2254,12 @@ fn mint() -> ColorScaleSet {
|
||||||
"#cbfee9f5",
|
"#cbfee9f5",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sky() -> ColorScaleSet {
|
fn sky() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Sky",
|
scale: "Sky",
|
||||||
light: [
|
light: [
|
||||||
"#f9feffff",
|
"#f9feffff",
|
||||||
|
@ -2281,11 +2318,12 @@ fn sky() -> ColorScaleSet {
|
||||||
"#c2f3ffff",
|
"#c2f3ffff",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn black() -> ColorScaleSet {
|
fn black() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "Black",
|
scale: "Black",
|
||||||
light: [
|
light: [
|
||||||
"#0000000d",
|
"#0000000d",
|
||||||
|
@ -2344,11 +2382,12 @@ fn black() -> ColorScaleSet {
|
||||||
"#000000f2",
|
"#000000f2",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn white() -> ColorScaleSet {
|
fn white() -> ColorScaleSet {
|
||||||
DefaultColorScaleSet {
|
StaticColorScaleSet {
|
||||||
scale: "White",
|
scale: "White",
|
||||||
light: [
|
light: [
|
||||||
"#ffffff0d",
|
"#ffffff0d",
|
||||||
|
@ -2407,5 +2446,6 @@ fn white() -> ColorScaleSet {
|
||||||
"#fffffff2",
|
"#fffffff2",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
.into()
|
.try_into()
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,24 @@ use gpui2::{AppContext, Hsla, SharedString};
|
||||||
|
|
||||||
use crate::{ActiveTheme, Appearance};
|
use crate::{ActiveTheme, Appearance};
|
||||||
|
|
||||||
pub type ColorScale = [Hsla; 12];
|
/// A one-based step in a [`ColorScale`].
|
||||||
|
pub type ColorScaleStep = usize;
|
||||||
|
|
||||||
|
pub struct ColorScale(Vec<Hsla>);
|
||||||
|
|
||||||
|
impl FromIterator<Hsla> for ColorScale {
|
||||||
|
fn from_iter<T: IntoIterator<Item = Hsla>>(iter: T) -> Self {
|
||||||
|
Self(Vec::from_iter(iter))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::ops::Index<ColorScaleStep> for ColorScale {
|
||||||
|
type Output = Hsla;
|
||||||
|
|
||||||
|
fn index(&self, index: ColorScaleStep) -> &Self::Output {
|
||||||
|
&self.0[index - 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct ColorScales {
|
pub struct ColorScales {
|
||||||
pub gray: ColorScaleSet,
|
pub gray: ColorScaleSet,
|
||||||
|
@ -85,9 +102,6 @@ impl IntoIterator for ColorScales {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A one-based step in a [`ColorScale`].
|
|
||||||
pub type ColorScaleStep = usize;
|
|
||||||
|
|
||||||
pub struct ColorScaleSet {
|
pub struct ColorScaleSet {
|
||||||
name: SharedString,
|
name: SharedString,
|
||||||
light: ColorScale,
|
light: ColorScale,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue