Using SASS rgba functions in the context of CSS variables?
P粉476046165
P粉476046165 2023-09-16 10:15:44
0
1
529

How do we get SASSrgbato convertrgba(#4caf50, 0.1)torgba(76, 175, 80, 0.1)when the context is CSS When is the value side of a variable declared?

For clarity, here is an example:

$green: #4caf50; $green-rgba: rgba($green, 0.1); @debug $green-rgba; // rgba(76, 175, 80, 0.1)
The

@debugstatement will logrgba(76, 175, 80, 0.1), which is correct.

But if we try this:

test { --mat-mdc-button-ripple-color: rgba(#4caf50, 0.1); }

The compilation result is:

test { --mat-mdc-button-ripple-color: rgba(#4caf50, 0.1); }

idea?

P粉476046165
P粉476046165

reply all (1)
P粉060112396

Ok - after looking into the source code of the Angular Material button, the ripple code does this and it works:

--mat-mdc-button-ripple-color: #{rgba($color, 0.1)};
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!