Skip to content
This repository was archived by the owner on Feb 27, 2026. It is now read-only.

Commit 699a271

Browse files
Update lch() docs: add alpha parameter, improve hue description, fix image formats
1 parent 61e47a4 commit 699a271

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

content/css/concepts/colors/terms/lch/lch.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ CatalogContent:
1414
- 'paths/front-end-engineer-career-path'
1515
---
1616

17-
The **`lch()`** function defines colors using the LCH (Lightness, Chroma, Hue) color space, which provides a more perceptually uniform way to represent colors compared to traditional RGB or HSL color spaces.
17+
The **`lch()`** function defines colors using the LCH (Lightness, Chroma, Hue) color space, which provides a uniform way to represent colors compared to traditional RGB or HSL color spaces.
1818

1919
## Syntax
2020

2121
```pseudo
22-
<property>: lch(lightness chroma hue);
22+
<property>: lch(lightness chroma hue / alpha);
2323
```
2424

2525
- `lightness`: A percentage value from `0%` to `100%`. Represents the brightness of the color. `0%` is completely black, `100%` is completely white, and `50%` represents the mid-tone.
2626
- `chroma`: A number value (typically `0` to `150` or higher). Represents the colorfulness or intensity of the color. `0` represents a neutral gray with no color, while higher values represent more vivid colors.
27-
- `hue`: A unitless number value representing an angle in the color wheel from `0` to `360`. `0` represents red, `120` represents green, and `240` represents blue.
27+
- `hue`: An angle value on the color wheel. It can be given with units like `deg`, `rad`, or `turn`, or as a unitless number interpreted as degrees. Angles wrap, so they are not limited to `0``360`; for reference, `0deg` represents red, `120deg` represents green, and `240deg` represents blue.
28+
- `alpha` (optional): A number from `0` to `1`, or a percentage from `0%` to `100%`, representing the opacity of the color. `0` (or `0%`) is fully transparent, `1` (or `100%`) is fully opaque. Defaults to `1` if omitted.
2829

2930
## Example 1
3031

@@ -36,7 +37,7 @@ h1 {
3637

3738
Sets the font color of the `h1` element to a vibrant orange-yellow color with medium lightness:
3839

39-
![lch() Example 1](https://raw.githubusercontent.com/Codecademy/docs/main/media/css-colors-lch-example-1.png)
40+
![lch() Example 1](https://raw.githubusercontent.com/Codecademy/docs/main/media/css-colors-lch-example-1.jpg)
4041

4142
## Example 2
4243

@@ -48,4 +49,16 @@ p {
4849

4950
Sets the font color of the `p` element to a light purple color with moderate chroma:
5051

51-
![lch() Example 2](https://raw.githubusercontent.com/Codecademy/docs/main/media/css-colors-lch-example-2.png)
52+
![lch() Example 2](https://raw.githubusercontent.com/Codecademy/docs/main/media/css-colors-lch-example-2.jpg)
53+
54+
## Example 3
55+
56+
```css
57+
div {
58+
background-color: lch(60% 80 120 / 0.5);
59+
}
60+
```
61+
62+
Sets the background color of the `div` element to a semi-transparent green color with 50% opacity:
63+
64+
![lch() Example 3](https://raw.githubusercontent.com/Codecademy/docs/main/media/css-colors-lch-example-3.jpg)

media/css-colors-lch-example-3.jpg

7.33 KB
Loading

0 commit comments

Comments
 (0)