Skip to content

Commit 19cc3ee

Browse files
eero-lehtinenmrchantey
authored andcommitted
Add the original source for Oklab conversions (bevyengine#17199)
# Objective - Add the original source for Oklab calculations (a blog from the creator of Oklab) instead of linking to other Rust crates. ## Solution - Update the links.
1 parent 8cb3b97 commit 19cc3ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/bevy_color/src/oklaba.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ impl From<LinearRgba> for Oklaba {
224224
blue,
225225
alpha,
226226
} = value;
227-
// From https://github.com/DougLau/pix
228-
// Floats literals are truncated from the source code above, to avoid excessive precision.
227+
// From https://bottosson.github.io/posts/oklab/#converting-from-linear-srgb-to-oklab
228+
// Float literals are truncated to avoid excessive precision.
229229
let l = 0.41222146 * red + 0.53633255 * green + 0.051445995 * blue;
230230
let m = 0.2119035 * red + 0.6806995 * green + 0.10739696 * blue;
231231
let s = 0.08830246 * red + 0.28171885 * green + 0.6299787 * blue;
@@ -248,8 +248,8 @@ impl From<Oklaba> for LinearRgba {
248248
alpha,
249249
} = value;
250250

251-
// From https://github.com/Ogeon/palette/blob/e75eab2fb21af579353f51f6229a510d0d50a311/palette/src/oklab.rs#L312-L332
252-
// Floats literals are truncated from the source code above, to avoid excessive precision.
251+
// From https://bottosson.github.io/posts/oklab/#converting-from-linear-srgb-to-oklab
252+
// Float literals are truncated to avoid excessive precision.
253253
let l_ = lightness + 0.39633778 * a + 0.21580376 * b;
254254
let m_ = lightness - 0.105561346 * a - 0.06385417 * b;
255255
let s_ = lightness - 0.08948418 * a - 1.2914855 * b;

0 commit comments

Comments
 (0)