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.

Using imported value in rgba()

See original GitHub issue

I have the following:

/* colors.css */
@value midnight: #182947;
/* foo.css */
@value midnight from './colors.css';

.root {
  background-color: midnight;
  background-color: rgba(midnight, 0.97);
}

The output of this that I see in the browser is (similar to):

.foo__root___hwRbh {
  background-color: #182947;
  background-color: rgba(i__const_midnight_0, 0.97);
}

The value for midnight is not being interpolated correctly in the rgba() instance.

This occurs with css-loader@1.1.0 and with postcss-loader removed from my webpack configuration (I thought maybe one of my postcss plugins were conflicting).

Is this a bug? Or an unsupported use case?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:9
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
ctaeppercommented, May 14, 2016

same issue here, using color() from cssnext the value results in i__const… however i think the values plugin should run before cssnext, as i defined this order in my postcss plugin chain… so why is this not working?

3reactions
jedrichardscommented, Jan 29, 2016

Possibly related, I get a silent fail when using css-modulesify with postcss-cssnext and trying to use a color() function on an imported @value.

// colors.css
@value foo: #182947;
// component.css
@value foo from "../colors.css"

.root {
  color: color(foo l(+5%));
}

Above code causes watchify to just hang, no error message. color() function works as expected when not used on a @value.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rgba() - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
The rgba() functional notation expresses a color according to its red, green, and blue components. An optional alpha component represents ...
Read more >
CSS rgba() function - W3Schools
The rgba() function define colors using the Red-green-blue-alpha (RGBA) model. RGBA color values are an extension of RGB color values with an alpha...
Read more >
Python 3.6: 'c' argument looks like a single numeric RGB or ...
Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all...
Read more >
Functions | Material Dashboard 2 React @ Creative Tim
The rgba() function helps you to create a rgba color code. Copy. import rgba from "assets/theme/functions/rgba"; rgba(color, opacity);.
Read more >
Built-In Modules - Sass
You can even use var() in place of multiple arguments, since it might be replaced by multiple values! When a color function is...
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