Skip to content

Commit

Permalink
fix: fixing colors getting set to wireframe
Browse files Browse the repository at this point in the history
  • Loading branch information
misterbrownlee authored and GarthDB committed Jun 24, 2022
1 parent 4a72175 commit 323cfc0
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions lib/drover-json-formatter.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
const helpers = require("./helper-functions.js");

const initial = {
system: "Spectrum",
version: "0.0.0-development",
KEYS: {
DIMENSION_LAYOUT_TOKENS: "layoutTokens",
DIMENSION_COMPONENT_LAYOUT_TOKENS: "componentLayoutTokens",
COLOR_THEMES: "colorThemes",
COLOR_TOKENS: "colorTokens",
COLOR_ALIASES: "colorAliases",
COLOR_SEMANTICS: "colorSemantics",
DIMENSIONS: "dimensions",
},
colorThemes: {
light: {},
dark: {},
darkest: {},
},
dimensions: {},
};
system: "Spectrum",
version: "0.0.0-development",
KEYS: {
DIMENSION_LAYOUT_TOKENS: "layoutTokens",
DIMENSION_COMPONENT_LAYOUT_TOKENS: "componentLayoutTokens",
COLOR_THEMES: "colorThemes",
COLOR_TOKENS: "colorTokens",
COLOR_ALIASES: "colorAliases",
COLOR_SEMANTICS: "colorSemantics",
DIMENSIONS: "dimensions",
},
colorThemes: {
light: {},
dark: {},
darkest: {},
},
dimensions: {},
};

const genType = (token) => {
if (!token.path.includes("express")) {
if (helpers.colorRegex.test(token.value)) {
let stopPrefix = "";

if (token.path.includes("light")) {
return "light";
} else if (token.path.includes("dark")) {
return "dark";
} else if (token.path.includes("darkest")) {
return "darkest";
} else if (token.path.includes("wireframe")) {
return "wireframe";
} else {
return "colorGlobal";
}
Expand Down Expand Up @@ -112,6 +115,8 @@ const formatter = ({ dictionary, platform, file, options }) => {
} else {
token.attributes.tokenType = genType(token);
switch (token.attributes.tokenType) {
case "wireframe":
break;
case "dimensionGlobals":
case "desktop":
result.dimensions[
Expand Down

0 comments on commit 323cfc0

Please sign in to comment.