Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Commit

Permalink
fix(colors): add back in ibm-color-map (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack authored Jan 11, 2019
1 parent 546b352 commit b0ba7f8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/colors/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,35 @@ async function build() {
prettier.format(mixins, prettierOptions)
);

const colorMapValues = Object.keys(colors).map(swatch => {
return {
swatch,
value: Object.keys(colors[swatch]).reduce((acc, grade, index) => {
const property = `${grade}: ${colors[swatch][grade]},`;
if (index === 0) {
return property;
}
return acc + '\n' + property;
}, ''),
};
});
const colorMap = `$ibm-color-map: (
${colorMapValues
.map(
({ swatch, value }) => `${swatch}: (
${value}
),\n`
)
.join('\n')}
)`;

const colorsFile = `${GENERATED_COMMENT}
@import './mixins';
@include color-values();
${colorMap}
`;

await fs.writeFile(
Expand Down

0 comments on commit b0ba7f8

Please sign in to comment.