Search code examples
csssass

SASS: converting RGB to RGBa


I have set up the colours of my project like so:

$blue: rgb(75, 179, 209);

Is there any way to use this variable and convert the value into RGBa elsewhere as needed?


Solution

  • using rgba instance method

    you can

    $blue: rgb(75, 179, 209);
    
    body {
        background:rgba($blue, .5);
    }
    

    can test here: https://sass-lang.com/playground/