Skip to content

Commit

Permalink
fix expressions like {{background-default}}
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed Sep 26, 2018
1 parent 9025dd0 commit 0b57abf
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions lib/angular-scss-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ module.exports = class AngularScssFilter extends Filter {
}

replaceExpression(match, colorType, hue, opacity, contrast) {
// `default` is also accepted as a hue-value, because the background palettes are
// using it as a name for the default hue.
if (hue.indexOf('hue') === 0 || hue === 'default') {
hue = LIGHT_DEFAULT_HUES[colorType][hue];
}
// normalize `color` as `default`
hue = hue === 'color' ? 'default' : hue;

if (hue === 'color') {
if (LIGHT_DEFAULT_HUES[colorType] && LIGHT_DEFAULT_HUES[colorType][hue]) {
hue = LIGHT_DEFAULT_HUES[colorType][hue];
} else if (hue === 'default') {
hue = '500';
}

Expand All @@ -85,17 +84,14 @@ module.exports = class AngularScssFilter extends Filter {
}

replaceExpressionCssVar(match, colorType, hue, opacity, contrast) {
// `default` is also accepted as a hue-value, because the background palettes are
// using it as a name for the default hue.
if (hue.indexOf('hue') === 0 || hue === 'default') {
hue = LIGHT_DEFAULT_HUES[colorType][hue];
}
// normalize `color` into `default`
hue = hue === 'color' ? 'default' : hue;

if (hue === 'contrast') {
contrast = true;
}
contrast = hue === 'contrast';

if (hue === 'color' || hue === 'contrast') {
if (LIGHT_DEFAULT_HUES[colorType] && LIGHT_DEFAULT_HUES[colorType][hue]) {
hue = LIGHT_DEFAULT_HUES[colorType][hue];
} else if (hue === 'default' || hue === 'contrast') {
hue = '500';
}

Expand Down

0 comments on commit 0b57abf

Please sign in to comment.