Code Editor

Drag the edges to resize the window.

Code Editor

Web Browser

Learn

Functions and Operations

Sass also allows us to perform mathematical functions to compute measurements— including colors.

Here is how Sass computes colors:

- The operation is performed on the red, green, and blue components.
- It computes the answer by operating on every two digits.

```
$color: #010203 + #040506;
```

The above would compute piece-wise as follows:

```
01 + 04 = 05
02 + 05 = 07
03 + 06 = 09
```

and compile to:

```
color: #050709;
```

Sass arithmetic can also compute HSLA and string colors such as `red`

and `blue`

.

Community Forums

Get help and ask questions in the Codecademy Forums

Report a Bug

If you see a bug or any other issue with this page, please report it here.

Learn

Community Forums

Report a Bug

Learn

Community Forums

Report a Bug