Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SASS: converting RGB to RGBa

Tags:

css

sass

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?

like image 953
Steph Avatar asked Jan 31 '13 15:01

Steph


People also ask

How do I change colors in SCSS?

$color-red: #FF0000; $color-green: #00FF00; $color-blue: #0000FF; Remember, in order to use variables, or any of the benefits of SCSS for that matter, the stylesheet must have the '. scss' extension, and a preprocessor must be part of your website build system.


1 Answers

using rgba instance method

you can

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

body {
    background:rgba($blue, .5);
}

can test here: http://sass-lang.com/try.html

like image 79
MikeM Avatar answered Sep 21 '22 19:09

MikeM