question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Argument `$color` of `opacity($color)` must be a color

See original GitHub issue

Hi,

It seems that i have the same problem as this thread: https://github.com/react-toolbox/react-toolbox/issues/148

in ./ClientApp/app/components/app/app.component.scss
Module build failed: 
undefined
              ^
      Argument `$color` of `opacity($color)` must be a color

Backtrace:
	node_modules/@covalent/core/common/styles/_theme-functions.scss:58, in function `opacity`
	node_modules/@covalent/core/common/styles/_theme-functions.scss:58, in function `if`
	node_modules/@covalent/core/common/styles/_theme-functions.scss:58, in function `mat-color`
	node_modules/@angular/material/_theming.scss:2540, in mixin `mat-slider-theme`
	node_modules/@angular/material/_theming.scss:2757, in mixin `angular-material-theme`
	stdin:14
      in C:\Users\SideKick\Documents\Visual Studio 2017\Projects\X\X.X\node_modules\@covalent\core\common\styles\_theme-functions.scss (line 58, column 16)
 @ ./ClientApp/app/components/app/app.component.ts 38:17-48
 @ ./ClientApp/app/app.module.shared.ts
 @ ./ClientApp/app/app.module.client.ts
 @ ./ClientApp/boot-client.ts
 @ multi event-source-polyfill webpack-hot-middleware/client?path=%2F__webpack_hmr ./ClientApp/boot-client.ts

Package.json:

{
  "name": "X.X",
  "version": "0.0.0",
  "dependencies": {
    "@angular/animations": "^4.1.3",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.1.3",
    "@angular/core": "^4.1.3",
    "@angular/flex-layout": "2.0.0-beta.8",
    "@angular/forms": "^4.1.3",
    "@angular/http": "^4.1.3",
    "@angular/material": "^2.0.0-beta.5",
    "@angular/platform-browser": "^4.1.3",
    "@angular/platform-browser-dynamic": "^4.1.3",
    "@angular/platform-server": "^4.0.0",
    "@angular/router": "^4.1.3",
    "@covalent/core": "^1.0.0-beta.5",
    "@types/node": "7.0.18",
    "angular2-jwt": "^0.2.3",
    "angular2-template-loader": "0.6.2",
    "aspnet-prerendering": "^2.0.5",
    "aspnet-webpack": "^1.0.29",
    "auth0-js": "^8.7.0",
    "auth0-lock": "^10.16.0",
    "awesome-typescript-loader": "3.1.3",
    "css": "2.2.1",
    "css-loader": "0.28.1",
    "es6-shim": "0.35.3",
    "event-source-polyfill": "0.0.9",
    "expose-loader": "0.7.3",
    "extract-text-webpack-plugin": "2.1.0",
    "file-loader": "0.11.1",
    "hammerjs": "^2.0.8",
    "html-loader": "0.4.5",
    "isomorphic-fetch": "2.2.1",
    "jquery": "3.2.1",
    "json-loader": "0.5.4",
    "preboot": "4.5.2",
    "raw-loader": "^0.5.1",
    "reflect-metadata": "0.1.10",
    "rxjs": "^5.0.1",
    "sass-loader": "^6.0.5",
    "style-loader": "0.17.0",
    "to-string-loader": "1.1.5",
    "typescript": "2.3.2",
    "url-loader": "0.5.8",
    "webpack": "2.5.1",
    "webpack-hot-middleware": "2.18.0",
    "webpack-merge": "4.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@types/chai": "3.5.2",
    "@types/jasmine": "2.5.47",
    "@types/hammerjs": "^2.0.34",
    "chai": "3.5.0",
    "jasmine-core": "2.6.1",
    "karma": "1.7.0",
    "karma-chai": "0.1.0",
    "karma-chrome-launcher": "2.1.1",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.1.0",
    "karma-webpack": "2.0.3",
    "node-sass": "^4.5.3"
  }
}

I just updated my npm package, Is there a solution to fix it?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
agusdutracommented, Jan 31, 2018

Can you show the scss file where you define the theme? I was facing this issue because I was using wrong parameters for default, lighter and darker for some colors.

I was using:

$app-primary: mat-palette($mat-blue-grey, A700, A500, A900);

But if you go to the definition of $mat-blue-grey in _theme.scss of material, those variables are not defined, just a few have the ‘A’ before:

$mat-blue-grey: (
  50: #eceff1,
  100: #cfd8dc,
  200: #b0bec5,
  300: #90a4ae,
  400: #78909c,
  500: #607d8b,
  600: #546e7a,
  700: #455a64,
  800: #37474f,
  900: #263238,
  A100: #cfd8dc,
  A200: #b0bec5,
  A400: #78909c,
  A700: #455a64,
  contrast: (
    50: $black-87-opacity,
    100: $black-87-opacity,
    200: $black-87-opacity,
    300: $black-87-opacity,
    400: white,
    500: white,
    600: $white-87-opacity,
    700: $white-87-opacity,
    800: $white-87-opacity,
    900: $white-87-opacity,
    A100: $black-87-opacity,
    A200: $black-87-opacity,
    A400: white,
    A700: $white-87-opacity,
  )
);


Using only the numbers and removing the ‘A’ before, fixed the issue for me.

$app-primary: mat-palette($mat-blue-grey, 700, 500, 900);

2reactions
emoralesb05commented, Jun 14, 2017

Huh, thats weird. But good to know it all works now 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - Argument `$color` of `opacity($color)` must be a color
I am trying to create Angular 2 theme, I follow the tutorial as mentioned on the site. This is my theme file. @import...
Read more >
CSS Colors - W3Schools
The CSS opacity property sets the opacity for the whole element (both background color and text will be opaque/transparent). The opacity property value...
Read more >
sass:color
The $red , $green , and $blue arguments must be unitless and between -255 and 255 (inclusive). The $hue argument must have either...
Read more >
Sass Color Functions - TutorialsTeacher
Creates a color based on the specified hue, saturation and lightness at the specified opacity. Returns a color that has the same saturation...
Read more >
An argument against CSS opacity - TPGi
If you use the opacity property or colors with alpha channels, that can trick automated accessibility tools into thinking that your site has ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found