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

Working with color functions


The functions available within Less can be used to provide some interesting colors. It is worth taking the time to familiarize yourself with the options available, particularly as it is possible to produce the same color using different methods!

The functions can be split into four groups—they cover color definition, channels, operations, and blending. Let's take a look at each group of functions in turn, starting with defining color formats.

Defining color formats

Before we can alter colors, we naturally need to define them. We could simply provide a HEX code, but this isn't always sufficient; Less allows us to do more. Less provides a number of methods to obtain colors using different formats, and these are the three that you will likely use the most:

Function

Creates an opaque color from

Example value

rgb

Decimal red, green, and blue (RGB) values

rgb(90, 129, 32)

hsl

Hue, saturation, and lightness (HSL) values

hsl(90, 100%, 50%)

hsv

Hue, saturation...