ember-paper: Error: argument `$color` of `rgba($color, $alpha)` must be a color

I got error this during a clean install of my master which was working.

In my package.json I had "ember-paper": "^1.0.0-alpha.20", and I’m using ember 2.12.2.

I removed the caret to set the version to exactly 1.0.0-alpha.20 and it fixed the error.

This must be an issue with the new version of ember-paper: 1.0.0-beta.1.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

Yes. contrastDefaultColor is the new constrast. For future reference, I’ll explain this change here.

We now have a much more powerful method for contrast colors. Basically, a palette has all the information it needs to know what contrast color a specific shade needs.

So, a palette can have:

  • contrastDefaultColor - the contrast color that is returned - you can specify any color, but the standard contrast colors are $light-contrast-color, $dark-contrast-color and $strong-light-contrast-color
  • contrastDarkColors - the shades of the palette that have $dark-contrast-color as its contrast color. This lets you override the default color for the shades you specify here.
  • contrastLightColors - the shades of the palette that have $light-contrast-color as its contrast color. This lets you override the default color for the shades you specify here.
  • contrastStrongLightColors - the shades of the palette that have $strong-light-contrast-color as its contrast color. This lets you override the default color for the shades you specify here.

Any of the last 3 can take a sass list of strings, e.g 'contrastLightColors': ('600', '700', '800', '900', 'A700'). You can take a look at the palettes file to see the built-in palettes: https://github.com/miguelcobain/ember-paper/blob/master/app/styles/color-palette.scss

This allows me to introduce the new colorContrast function. This function uses all of this information to return a contrast color given a specific color. It acts as the counterpart of the color function.

For example, if you want some element with the primary color and some text on it you can use:

.my-element {
  background-color: color($primary);
  color: colorContrast($primary);
}

This makes sure that the text will use the correct contrast according to the information in the palette.

I think this is a very powerful system, and lets me focus on colors globally, and not on a case by case basis.