Adam Baranyai
Adam Baranyai

Reputation: 3867

Converting hex color code, to rgba and fetching the red value

If I have a color code in sass in a hexadecimal format #aaaaaa, is there any way to convert this to an RGB format, and get only the red value number with a function?

An example on what I would like to achieve:

@function getRedValue($color) {
     // convert $color which will be provided in hexadecimal format, to rgba
     // return the red value of the color number
}

Upvotes: 0

Views: 103

Answers (1)

Cristian Sarghe
Cristian Sarghe

Reputation: 790

There are some SASS default color functions you could use.

Please check red(), green() and blue().

Upvotes: 1

Related Questions