Skip to content

Commit

Permalink
fix(color): update oklab LMS matrices
Browse files Browse the repository at this point in the history
- according to @bottosson they were already updated in 01/2021
  • Loading branch information
postspectacular committed Mar 1, 2023
1 parent ae5cd82 commit 6e2cb75
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions packages/color/src/oklab/oklab-rgb.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import type { ColorOp } from "../api.js";
import { __mulV33 } from "../internal/matrix-ops.js";

/**
* @remarks
* Reference:
* - https://bottosson.github.io/posts/oklab/#converting-from-linear-srgb-to-oklab
*
* @internal
*/
// prettier-ignore
const LMS_CONE = [
4.0767245293, -1.2681437731, -0.0041119885, -3.3072168827, 2.6093323231,
-0.7034763098, 0.2307590544, -0.341134429, 1.7068625689,
4.0767416621, -1.2684380046, -0.0041960863,
-3.307711591, 2.6097574011, -0.7034186147,
0.2309699292, -0.3413193965, 1.707614701,
];

/**
Expand Down
13 changes: 11 additions & 2 deletions packages/color/src/rgb/rgb-oklab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ import type { ColorOp } from "../api.js";
import { OKLAB_M2 } from "../api/constants.js";
import { __mulV33 } from "../internal/matrix-ops.js";

/**
* @remarks
* Reference:
* - https://bottosson.github.io/posts/oklab/#converting-from-linear-srgb-to-oklab
*
* @internal
*/
// prettier-ignore
const CONE_LMS = [
0.412165612, 0.211859107, 0.0883097947, 0.536275208, 0.6807189584,
0.2818474174, 0.0514575653, 0.107406579, 0.6302613616,
0.4122214708, 0.2119034982, 0.0883024619,
0.5363325363, 0.6806995451, 0.2817188376,
0.0514459929, 0.1073969566, 0.6299787005,
];

/**
Expand Down

0 comments on commit 6e2cb75

Please sign in to comment.