-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add changing of entire colorgroups simultaneously - changing the basecolor will automatically change all shaded of that color
- Loading branch information
Ilari Sinkkonen
committed
May 30, 2017
1 parent
579f135
commit 37e3092
Showing
3 changed files
with
138 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Colors are named like this: <group>Color<lightness> | ||
* Lightness may be blank, and 'Color' will be omitted with grey shades, eg. greyLight | ||
* Basecolors are all colors without a lightness, except for infoColor | ||
*/ | ||
|
||
export const getColorData = colorName => { | ||
if (colorName.indexOf('Color') === -1) { | ||
return { | ||
group: 'grey', | ||
isBaseColor: colorName === 'grey', | ||
lightness: colorName.slice(4), | ||
}; | ||
} | ||
|
||
const [group, lightness] = colorName.split('Color'); | ||
|
||
return { | ||
group, | ||
lightness, | ||
colorName, | ||
isBaseColor: lightness === '' && group !== 'info' && group !== 'text', | ||
}; | ||
} | ||
|
||
export const getColorName = colorData => { | ||
const { group, lightness } = colorData; | ||
|
||
return `${group}${group === 'grey' ? '' : 'Color'}${lightness}`; | ||
} |