JeePee
JeePee

Reputation: 105

Get the output color of RGBA over RGB

I'm very new with LESS and still learning. How can I get the output color in RBG of a color with opacity over a base color?

For example:

90% WHITE over RED = #ffbfbf (pinkish)

Upvotes: 1

Views: 209

Answers (1)

Josh Crozier
Josh Crozier

Reputation: 240928

LESS has built-in color functions to handle this.

In your case, you could get 90% of white using darken(#fff, 10%). From there you could use the mix() function to combine that with red at a specified weight.

For example:

background-color: mix(darken(#fff, .1), #f00, 75%);

Outputs:

background-color: #ffbfbf;

Upvotes: 1

Related Questions