Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OKLCH and OKLab functions to reference #15033

Merged
merged 5 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions files/en-us/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10965,6 +10965,8 @@
/en-US/docs/Web/CSS/color_value/hwb() /en-US/docs/Web/CSS/color_value/hwb
/en-US/docs/Web/CSS/color_value/lab() /en-US/docs/Web/CSS/color_value/lab
/en-US/docs/Web/CSS/color_value/lch() /en-US/docs/Web/CSS/color_value/lch
/en-US/docs/Web/CSS/color_value/oklab() /en-US/docs/Web/CSS/color_value/oklab
/en-US/docs/Web/CSS/color_value/oklch() /en-US/docs/Web/CSS/color_value/oklch
/en-US/docs/Web/CSS/color_value/rgb() /en-US/docs/Web/CSS/color_value/rgb
/en-US/docs/Web/CSS/color_value/rgba() /en-US/docs/Web/CSS/color_value/rgba
/en-US/docs/Web/CSS/conic-gradient /en-US/docs/Web/CSS/gradient/conic-gradient
Expand Down
51 changes: 51 additions & 0 deletions files/en-us/web/css/color_value/oklab/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: oklab()
slug: Web/CSS/color_value/oklab
tags:
- CSS
- CSS Data Type
- Data Type
- Reference
- Web
- color
- oklab
ai marked this conversation as resolved.
Show resolved Hide resolved
- Experimental
browser-compat: css.types.color.oklab
---
{{CSSRef}}

The **`oklab()`** functional notation expresses a given color in the Oklab color space. Oklab represents the entire range of color that humans can see.

## Syntax

```css
oklab(40.1% 0.1143 0.045);
oklab(59.69% 0.1007 0.1191);
oklab(59.69% 0.1007 0.1191 / .5);
```

### Values

- Functional notation: `oklab(L a b [/ A])`

- : `L` specifies the perceived lightness, and is a {{cssxref("<percentage>")}} between `0%` representing black and `100%` representing white.

The second argument `a` is the distance along the `a` axis in the Oklab colorspace.

The third argument `b` is the distance along the `b` axis in the Oklab colorspace.

`A` (alpha) can be a {{cssxref("<number>")}} between `0` and `1`, or a {{cssxref("<percentage>")}}, where the number `1` corresponds to `100%` (full opacity).

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [A perceptual color space for image processing](https://bottosson.github.io/posts/oklab/)
- [Safari Technology Preview 137 release notes](https://webkit.org/blog/12156/release-notes-for-safari-technology-preview-137/): includes `oklab()` and {{cssxref("color_value/oklch",'oklch()')}} colors.

50 changes: 50 additions & 0 deletions files/en-us/web/css/color_value/oklch/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: oklch()
slug: Web/CSS/color_value/oklch
tags:
- CSS
- CSS Data Type
- Data Type
- Reference
- Web
- color
- oklch
ai marked this conversation as resolved.
Show resolved Hide resolved
- Experimental
browser-compat: css.types.color.oklch
---
{{CSSRef}}

The **`oklch()`** functional notation expresses a given color in the OKLCH color space. It has the same L axis as {{cssxref("color_value/oklab","oklab()")}}, but uses polar coordinates C (Chroma) and H (Hue).

## Syntax

```css
oklch(40.1% 0.123 21.57)
oklch(59.69% 0.156 49.77)
oklch(59.69% 0.156 49.77 / .5)
```

### Values

- Functional notation: `oklch(L C H [/ A])`

- : `L` specifies the perceived lightness, and is a {{cssxref("<percentage>")}} between `0%` representing black and `100%` representing white.

The second argument `C` is the chroma (roughly representing the "amount of color"). Its minimum useful value is 0, while its maximum is theoretically unbounded (but in practice does not exceed 0.4).

The third argument `H` is the hue angle. `0deg` points along the positive "a" axis (toward purplish red), `90deg` points along the positive "b" axis (toward mustard yellow), `180deg` points along the negative "a" axis (toward greenish cyan), and `270deg` points along the negative "b" axis (toward sky blue).

`A` (alpha) can be a {{cssxref("<number>")}} between `0` and `1`, or a {{cssxref("<percentage>")}}, where the number `1` corresponds to `100%` (full opacity).

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [A perceptual color space for image processing](https://bottosson.github.io/posts/oklab/)
- [Safari Technology Preview 137 release notes](https://webkit.org/blog/12156/release-notes-for-safari-technology-preview-137/): includes `oklch()` and {{cssxref("color_value/oklab",'oklab()')}} colors.
4 changes: 4 additions & 0 deletions files/en-us/web/css/css_functions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ Functions which specify different color representations. These may be used anywh
- : Lab color is device-independent and specifies physical measurements of color.
- {{cssxref("color_value/lch", "lch()")}} {{Experimental_Inline}}
- : LCH color is device-independent and specifies color using polar coordinates for chroma and hue.
- {{cssxref("color_value/oklab", "oklab()")}} {{Experimental_Inline}}
- : OKLab color is device-independent and specifies physical measurements of color.
- {{cssxref("color_value/oklch", "oklch()")}} {{Experimental_Inline}}
- : OKLCH color is device-independent and specifies color using polar coordinates for chroma and hue.
- {{cssxref("color_value/rgb", "rgb()")}}
- : The RGB color model defines a given color according to its red, green, and blue components. An optional alpha component represents the color's transparency.
- {{cssxref("color_value/rgba", "rgba()")}}
Expand Down