Book Image

Learning less.js

Book Image

Learning less.js

Overview of this book

Table of Contents (22 chapters)
Learning Less.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Color blending


Our final group of functions handle the blending of colors within Less:

Function

Purpose of the function

Example value

multiply

Multiplies two colors.

multiply(#9ec1ef, #091d37);

screen

Does the opposite of multiply. The result is a brighter color.

screen (#9ec1ef, #091d37);

overlay

Combines the effects of both multiply and screen. Conditionally makes light channels lighter and dark channels darker.

overlay (#9ec1ef, #091d37);

softlight

Similar to overlay but avoids pure black resulting in pure black, and pure white resulting in pure white.

softlight (#9ec1ef, #091d37);

hardlight

The same as overlay but with the color roles reversed.

hardlight (#9ec1ef, #091d37);

difference

Subtracts the second color from the first color on a channel-by-channel basis.

difference (#9ec1ef, #091d37);

exclusion

A similar effect to difference but with lower contrast.

exclusion (#9ec1ef, #091d37);

average

Computes the average of two colors on a per-channel (RGB) basis.

average (#9ec1ef, #091d37);

negation

Does the opposite of difference.

negation (#9ec1ef, #091d37);

Tip

For more information, read the documentation on the main Less site at http://lesscss.org/functions/#color-blending. I've also created a CodePen that shows these effects in action—this is available at http://codepen.io/alibby251/pen/IKqEk.