diff --git a/scripts/Figma.json b/scripts/Figma.json index 8887c4e4c3..5d51276be0 100644 --- a/scripts/Figma.json +++ b/scripts/Figma.json @@ -1,379 +1,4 @@ [ - { - "name": "Type set", - "values": [ - { - "mode": { - "name": "Laptop", - "id": "21676:0" - }, - "color": [], - "number": [ - { - "name": "font-size/2xl", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/3xl", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/4xl", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/base", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/lg", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/md", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/xl", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/xl 2", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/xm", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/xs", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/2xl-32", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/3xl-36", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/4xl-44", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/base-16", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/lg-18", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/md-16", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/xl-24", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/xm-14", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/xs-12", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Black 900", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Bold 700", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/ExtraBold 800", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/ExtraLight 200", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Light 300", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Medium 500", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Regular 400", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/SemiBold 600", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - } - ], - "string": [ - { - "name": "code_font-face", - "value": "jet brains mono", - "var": "", - "rootAlias": "" - }, - { - "name": "global_font_face", - "value": "Mona Sans", - "var": "", - "rootAlias": "" - } - ] - }, - { - "mode": { - "name": "Mobile", - "id": "21685:0" - }, - "color": [], - "number": [ - { - "name": "font-size/2xl", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/3xl", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/4xl", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/base", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/lg", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/md", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/xl", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/xl 2", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/xm", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "font-size/xs", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/2xl-32", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/3xl-36", - "value": "Infinityrem", - "var": "line-height/xl-24", - "rootAlias": "line-height/xl-24" - }, - { - "name": "line-height/4xl-44", - "value": "Infinityrem", - "var": "line-height/xl-24", - "rootAlias": "line-height/xl-24" - }, - { - "name": "line-height/base-16", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/lg-18", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/md-16", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/xl-24", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/xm-14", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "line-height/xs-12", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Black 900", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Bold 700", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/ExtraBold 800", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/ExtraLight 200", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Light 300", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Medium 500", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/Regular 400", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - }, - { - "name": "variables/SemiBold 600", - "value": "Infinityrem", - "var": "", - "rootAlias": "" - } - ], - "string": [ - { - "name": "code_font-face", - "value": "Source Code Pro", - "var": "", - "rootAlias": "" - }, - { - "name": "global_font_face", - "value": "Mona Sans", - "var": "", - "rootAlias": "" - } - ] - } - ] - }, { "name": "Colors", "values": [ @@ -558,7 +183,7 @@ "rootAlias": "" }, { - "name": "ks/Color-gradient-1-inverse-2", + "name": "ks/Color-gradient-1-inverse 2", "value": "#25232e", "var": "", "rootAlias": "" @@ -613,9 +238,9 @@ }, { "name": "ks/background-button-primary-hover", - "value": "#cdc5ff", - "var": "primary/200", - "rootAlias": "primary/200" + "value": "#8465ff", + "var": "primary/400", + "rootAlias": "primary/400" }, { "name": "ks/background-button-secondary", @@ -689,6 +314,18 @@ "var": "grey/800", "rootAlias": "grey/800" }, + { + "name": "ks/background-tag-category", + "value": "#f1efff", + "var": "primary/100", + "rootAlias": "primary/100" + }, + { + "name": "ks/background-tag-success", + "value": "#bffddd", + "var": "green/100", + "rootAlias": "green/100" + }, { "name": "ks/background-tertiary", "value": "#f1f1f1", @@ -701,18 +338,6 @@ "var": "grey/Black", "rootAlias": "grey/Black" }, - { - "name": "ks/backgroung-tag-category", - "value": "#f1efff", - "var": "primary/100", - "rootAlias": "primary/100" - }, - { - "name": "ks/backgroung-tag-success", - "value": "#bffddd", - "var": "green/100", - "rootAlias": "green/100" - }, { "name": "ks/blur-effect", "value": "#a796ff", @@ -852,7 +477,7 @@ "rootAlias": "grey/white" }, { - "name": "ks/content-propertie", + "name": "ks/content-property", "value": "#1761fd", "var": "blue/400", "rootAlias": "blue/400" @@ -937,7 +562,7 @@ }, { "name": "ks/shadows-light", - "value": "#2720560d", + "value": "#3952f21a", "var": "", "rootAlias": "" }, @@ -947,6 +572,12 @@ "var": "", "rootAlias": "" }, + { + "name": "ks/shadows-xl-inverse", + "value": "#9d6aeb", + "var": "", + "rootAlias": "" + }, { "name": "ks/special-green", "value": "#06f0b1", @@ -1288,7 +919,7 @@ "rootAlias": "" }, { - "name": "ks/Color-gradient-1-inverse-2", + "name": "ks/Color-gradient-1-inverse 2", "value": "#e9e5fe", "var": "", "rootAlias": "" @@ -1343,9 +974,9 @@ }, { "name": "ks/background-button-primary-hover", - "value": "#7b47ec", - "var": "", - "rootAlias": "" + "value": "#8465ff", + "var": "primary/400", + "rootAlias": "primary/400" }, { "name": "ks/background-button-secondary", @@ -1419,6 +1050,18 @@ "var": "grey/50", "rootAlias": "grey/50" }, + { + "name": "ks/background-tag-category", + "value": "#a796ff", + "var": "primary/300", + "rootAlias": "primary/300" + }, + { + "name": "ks/background-tag-success", + "value": "#215d42", + "var": "green/700", + "rootAlias": "green/700" + }, { "name": "ks/background-tertiary", "value": "#131316", @@ -1431,18 +1074,6 @@ "var": "grey/100", "rootAlias": "grey/100" }, - { - "name": "ks/backgroung-tag-category", - "value": "#a796ff", - "var": "primary/300", - "rootAlias": "primary/300" - }, - { - "name": "ks/backgroung-tag-success", - "value": "#215d42", - "var": "green/700", - "rootAlias": "green/700" - }, { "name": "ks/blur-effect", "value": "#581fd38f", @@ -1582,7 +1213,7 @@ "rootAlias": "grey/Black" }, { - "name": "ks/content-propertie", + "name": "ks/content-property", "value": "#a9b5fe", "var": "blue/200", "rootAlias": "blue/200" @@ -1677,6 +1308,12 @@ "var": "", "rootAlias": "" }, + { + "name": "ks/shadows-xl-inverse", + "value": "#533ce647", + "var": "", + "rootAlias": "" + }, { "name": "ks/special-green", "value": "#15b983", @@ -1839,5 +1476,4 @@ } ] } -] - +] \ No newline at end of file diff --git a/scripts/generate-palette.mjs b/scripts/generate-palette.mjs index 7576da5d97..57533fa712 100644 --- a/scripts/generate-palette.mjs +++ b/scripts/generate-palette.mjs @@ -1,20 +1,21 @@ // @ts-check -import fs from "fs"; -import path from "path"; -import { fileURLToPath } from "url"; -import figma from "./Figma.json" with { type: "json" }; +import fs from "fs" +import path from "path" +import { fileURLToPath } from "url" +import figma from "./Figma.json" with { type: "json" } -const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const __dirname = path.dirname(fileURLToPath(import.meta.url)) const AUTO_GENERATED_COMMENT = `/** * This file is auto-generated by scripts/generate-palette.mjs. * It is a summary of color choices made in Figma. * Should you need to make a change in it, ask a designer * at Kestra first, so your changes are not overwritten. - */`; + */` -const [{ color: paletteLight }, { color: paletteDark }] = figma[1].values; +const [{ color: paletteLight }, { color: paletteDark }] = + figma.find((p) => p.name === "Colors")?.values || [] /** * @param {Array<{name: string, value: string}>} palette1 @@ -22,12 +23,14 @@ const [{ color: paletteLight }, { color: paletteDark }] = figma[1].values; */ const checkPalette = (palette1, palette2) => { for (const color1 of palette1) { - const color2 = palette2.find((c) => c.name === color1.name); + const color2 = palette2.find((c) => c.name === color1.name) if (!color2 || color2.value !== color1.value) { - console.error(`Color ${color1.name} is different in the two palettes`); + console.error( + `Color ${color1.name} is different in the two palettes`, + ) } } -}; +} /** * @param {{var?: string, value: string}} color @@ -36,21 +39,22 @@ const checkPalette = (palette1, palette2) => { const getValue = (color, colorIndex) => { // If it's a reference to a base color (grey/ or primary/) if (color.var?.match(/^(grey|primary)\//)) { - return `$base-${color.var.replace(/\//g, "-")}`; + return `$base-${color.var.replace(/\//g, "-")}` } // if the value of the color has 8 hexadecimal it has an alpha channel // we therefore extract the color and compare it with the values in the base palette if (color.value.length === 9) { - const alpha = Math.round(parseInt(color.value.slice(7), 16) / 2.55) / 100; - const baseColor = color.value.slice(0, 7); - const baseColorName = colorIndex[baseColor]; + const alpha = + Math.round(parseInt(color.value.slice(7), 16) / 2.55) / 100 + const baseColor = color.value.slice(0, 7) + const baseColorName = colorIndex[baseColor] if (baseColorName) { - return `rgba($base-${baseColorName.replace(/\//g, "-")}, ${alpha})`; + return `rgba($base-${baseColorName.replace(/\//g, "-")}, ${alpha})` } } - return color.value; -}; + return color.value +} /** * @param {Array<{name: string, value: string}>} themeColors @@ -58,25 +62,25 @@ const getValue = (color, colorIndex) => { */ const getVariableScss = (themeColors, colorIndex) => { /** @type {string | null} */ - let prevCategory = null; + let prevCategory = null return themeColors .map((c) => { - const currentCategory = c.name.replace(/^ks\//, "").split("-")[0]; - const val = getValue(c, colorIndex); + const currentCategory = c.name.replace(/^ks\//, "").split("-")[0] + const val = getValue(c, colorIndex) const categoryTitle = currentCategory !== prevCategory ? `\n\t/* ${currentCategory} */\n` - : ""; + : "" - const varName = c.name.replace(/\//g, "-"); - prevCategory = currentCategory; + const varName = c.name.replace(/[/ ]/g, "-") + prevCategory = currentCategory - return `${categoryTitle}\t#{--${varName}}: ${val};`; + return `${categoryTitle}\t#{--${varName}}: ${val};` }) .join("\n") - .trim(); -}; + .trim() +} /** * @param {Array<{name: string, value: string}>} palette @@ -88,49 +92,52 @@ const makePalettes = (palette, paletteName, selector) => { const baseColors = palette .filter((c) => c.name.match(/^(grey|primary)\//)) .sort((a, b) => { - const [categoryA, numA] = a.name.split("/"); - const [categoryB, numB] = b.name.split("/"); - if (categoryA !== categoryB) return categoryA.localeCompare(categoryB); - return parseInt(numA) - parseInt(numB); - }); + const [categoryA, numA] = a.name.split("/") + const [categoryB, numB] = b.name.split("/") + if (categoryA !== categoryB) + return categoryA.localeCompare(categoryB) + return parseInt(numA) - parseInt(numB) + }) const colorIndex = baseColors.reduce( (acc, color) => ({ ...acc, [color.value]: color.name }), - {} - ); + {}, + ) const scss = baseColors - .map((color) => `$base-${color.name.replace(/\//g, "-")}: ${color.value};`) - .join("\n"); + .map( + (color) => + `$base-${color.name.replace(/\//g, "-")}: ${color.value};`, + ) + .join("\n") // write the scss file containing colors in the base palette fs.writeFileSync( path.resolve(__dirname, "../src/assets/styles/_color-palette.scss"), `${AUTO_GENERATED_COMMENT}\n${scss}`, - { encoding: "utf-8" } - ); + { encoding: "utf-8" }, + ) const tokenScss = getVariableScss( palette.filter((c) => !c.name.match(/^(grey|primary)\//)), - colorIndex - ); + colorIndex, + ) // write the scss file containing colors in the token palette fs.writeFileSync( path.resolve( __dirname, - `../src/assets/styles/ks-theme-${paletteName}.scss` + `../src/assets/styles/ks-theme-${paletteName}.scss`, ), `${AUTO_GENERATED_COMMENT}\n@import "./color-palette.scss";\n\n${selector}{\n\t${tokenScss}\n}`, - { encoding: "utf-8" } - ); - - return baseColors; -}; + { encoding: "utf-8" }, + ) -const colorLight = makePalettes(paletteLight, "light", ":root"); -const colorDark = makePalettes(paletteDark, "dark", "html.dark"); + return baseColors +} -checkPalette(colorLight, colorDark); -checkPalette(colorDark, colorLight); +const colorLight = makePalettes(paletteLight, "light", ":root") +const colorDark = makePalettes(paletteDark, "dark", "html.dark") +checkPalette(colorLight, colorDark) +checkPalette(colorDark, colorLight) diff --git a/src/assets/styles/ks-theme-dark.scss b/src/assets/styles/ks-theme-dark.scss index 0dac95cce4..f609fd56f1 100644 --- a/src/assets/styles/ks-theme-dark.scss +++ b/src/assets/styles/ks-theme-dark.scss @@ -68,7 +68,7 @@ html.dark{ #{--ks-background-blue-light}: #65a5ff33; #{--ks-background-body}: $base-grey-700; #{--ks-background-button-primary}: $base-primary-base; - #{--ks-background-button-primary-hover}: #7b47ec; + #{--ks-background-button-primary-hover}: $base-primary-400; #{--ks-background-button-secondary}: $base-grey-700; #{--ks-background-button-secondary-active}: $base-grey-600; #{--ks-background-button-secondary-hover}: $base-grey-white; @@ -81,13 +81,11 @@ html.dark{ #{--ks-background-purple-light}: rgba($base-primary-400, 0.2); #{--ks-background-secondary}: $base-grey-800; #{--ks-background-secondary-inverse}: $base-grey-50; + #{--ks-background-tag-category}: $base-primary-300; + #{--ks-background-tag-success}: #215d42; #{--ks-background-tertiary}: $base-grey-Black; #{--ks-background-tertiary-inverse}: $base-grey-100; - /* backgroung */ - #{--ks-backgroung-tag-category}: $base-primary-300; - #{--ks-backgroung-tag-success}: #215d42; - /* blur */ #{--ks-blur-effect}: #581fd38f; @@ -116,7 +114,7 @@ html.dark{ #{--ks-content-output}: #80fac5; #{--ks-content-primary}: $base-grey-white; #{--ks-content-primary-inverse}: $base-grey-Black; - #{--ks-content-propertie}: #a9b5fe; + #{--ks-content-property}: #a9b5fe; #{--ks-content-secondary}: $base-grey-200; #{--ks-content-secondary-inverse}: $base-grey-600; #{--ks-content-tag-category}: $base-grey-Black; @@ -138,6 +136,7 @@ html.dark{ #{--ks-shadows-hight}: #a8a8c7; #{--ks-shadows-light}: #22222f; #{--ks-shadows-light-inverse}: #2720560d; + #{--ks-shadows-xl-inverse}: #533ce647; /* special */ #{--ks-special-green}: #15b983; @@ -190,5 +189,4 @@ html.dark{ /* red/base */ #{--red-base}: #ab0009; -} - +} \ No newline at end of file diff --git a/src/assets/styles/ks-theme-light.scss b/src/assets/styles/ks-theme-light.scss index 82a82a3fee..26da774057 100644 --- a/src/assets/styles/ks-theme-light.scss +++ b/src/assets/styles/ks-theme-light.scss @@ -68,7 +68,7 @@ #{--ks-background-blue-light}: #eff4ff; #{--ks-background-body}: $base-grey-white; #{--ks-background-button-primary}: $base-primary-base; - #{--ks-background-button-primary-hover}: $base-primary-200; + #{--ks-background-button-primary-hover}: $base-primary-400; #{--ks-background-button-secondary}: $base-grey-white; #{--ks-background-button-secondary-active}: $base-grey-white; #{--ks-background-button-secondary-hover}: $base-grey-Black; @@ -81,13 +81,11 @@ #{--ks-background-purple-light}: $base-primary-100; #{--ks-background-secondary}: $base-grey-50; #{--ks-background-secondary-inverse}: $base-grey-800; + #{--ks-background-tag-category}: $base-primary-100; + #{--ks-background-tag-success}: #bffddd; #{--ks-background-tertiary}: $base-grey-100; #{--ks-background-tertiary-inverse}: $base-grey-Black; - /* backgroung */ - #{--ks-backgroung-tag-category}: $base-primary-100; - #{--ks-backgroung-tag-success}: #bffddd; - /* blur */ #{--ks-blur-effect}: $base-primary-300; @@ -116,7 +114,7 @@ #{--ks-content-output}: #1e875e; #{--ks-content-primary}: $base-grey-Black; #{--ks-content-primary-inverse}: $base-grey-white; - #{--ks-content-propertie}: #1761fd; + #{--ks-content-property}: #1761fd; #{--ks-content-secondary}: $base-grey-600; #{--ks-content-secondary-inverse}: $base-grey-200; #{--ks-content-tag-category}: $base-primary-500; @@ -136,8 +134,9 @@ /* shadows */ #{--ks-shadows-hight}: #27205633; - #{--ks-shadows-light}: #2720560d; + #{--ks-shadows-light}: #3952f21a; #{--ks-shadows-light-inverse}: #22222f; + #{--ks-shadows-xl-inverse}: #9d6aeb; /* special */ #{--ks-special-green}: #06f0b1; @@ -190,5 +189,4 @@ /* red/base */ #{--red-base}: #ab0009; -} - +} \ No newline at end of file