mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 12:54:42 +00:00
WIP: Add rose
color tokens to core.ts
This commit is contained in:
parent
2aebb04a84
commit
bfce4a6104
1 changed files with 45 additions and 0 deletions
|
@ -1,6 +1,51 @@
|
||||||
|
import chroma from "chroma-js";
|
||||||
|
|
||||||
export type Color = string;
|
export type Color = string;
|
||||||
|
|
||||||
|
function getColorRamp(colorName, baseColor, steps = 10) {
|
||||||
|
let hsl = chroma(baseColor).hsl();
|
||||||
|
let h = Math.round(hsl[0]);
|
||||||
|
let lightColor = chroma.hsl(h, 0.88, 0.96).hex();
|
||||||
|
let darkColor = chroma.hsl(h, 0.68, 0.32).hex();
|
||||||
|
|
||||||
|
let ramp = chroma
|
||||||
|
.scale([lightColor, baseColor, darkColor])
|
||||||
|
.domain([0, 0.5, 1])
|
||||||
|
.mode("hsl")
|
||||||
|
.gamma(1)
|
||||||
|
.correctLightness(true)
|
||||||
|
.padding([0, 0.15])
|
||||||
|
.colors(steps);
|
||||||
|
|
||||||
|
let tokens = {};
|
||||||
|
let token = {};
|
||||||
|
let colorNumber = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < steps; i++) {
|
||||||
|
if (i !== 0) {
|
||||||
|
colorNumber = i * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
token = {
|
||||||
|
[`${colorName}_${colorNumber}`]: {
|
||||||
|
value: ramp[i].value,
|
||||||
|
rootValue: baseColor,
|
||||||
|
step: i,
|
||||||
|
type: "color",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.assign(token, tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
color: {
|
||||||
|
rose: getColorRamp("rose", "#F43F5E", 10),
|
||||||
|
},
|
||||||
|
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
sans: "Zed Sans",
|
sans: "Zed Sans",
|
||||||
mono: "Zed Mono",
|
mono: "Zed Mono",
|
||||||
|
|
Loading…
Reference in a new issue