Skip to content

Commit ac3ad1a

Browse files
committed
Update migration guide for 3.0
1 parent ba1bc0a commit ac3ad1a

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

docs/api.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,12 +1599,9 @@ import { useParser } from 'culori';
15991599

16001600
// Register custom parser
16011601
useParser(function(str) => {
1602-
return {
1603-
mode: 'rgb',
1604-
r: 0,
1605-
g: 0,
1606-
b: 0
1607-
};
1602+
let color = {};
1603+
// parse the string
1604+
return color;
16081605
});
16091606

16101607
// Register `color(--oklab)` syntax
@@ -1615,7 +1612,7 @@ useParser('--oklab', 'oklab');
16151612

16161613
<span aria-label='Source:'>☞</span> [src/modes.js]({{codebase}}/src/modes.js)
16171614

1618-
Remove a previously registered parser function.
1615+
Remove a previously registered parser function or string, including parsers registered by default.
16191616

16201617
```js
16211618
import { parse, parseNamed, removeParser } from 'culori';

docs/guides/migration.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@ title: 'Migration guide'
44

55
## Migrating from version 2.x to 3.0
66

7-
###
7+
For better alignment with the CSS Color Level 4 specification, support for the following syntaxes has changed:
8+
9+
* `color(--oklab)` removed in favor of `oklab()`
10+
* `color(--oklch)` removed in favor of `oklch()`
11+
* `color(--srgb-linear)` removed in favor of `color(srgb-linear)`
12+
* `color(--xyz-d50)` removed in favor of `color(xyz-d50)`
13+
* `color(--xyz-d65)` removed in favor of `color(xyz)` and `color(xyz-d65)`
14+
15+
The custom identifiers removed in this release can be re-registered with [`useParser()`](/api/#useParser), using string arguments:
16+
17+
```js
18+
import { useParser } from 'culori';
19+
20+
useParser('--oklab', 'oklab');
21+
useParser('--oklch', 'oklch');
22+
useParser('--srgb-linear', 'lrgb');
23+
useParser('--xyz-d50', 'xyz50');
24+
useParser('--xyz-d65', 'xyz65');
25+
```
826

927
## Migrating from version 1.x to 2.0
1028

0 commit comments

Comments
 (0)