From c728bfa5d7436e2f26e6ca5e4f262c6fd1f24366 Mon Sep 17 00:00:00 2001 From: Romain Menke <11521496+romainmenke@users.noreply.github.com> Date: Wed, 1 Nov 2023 18:19:17 +0100 Subject: [PATCH] update color-helpers (#1168) --- packages/color-helpers/dist/index.cjs | 2 +- packages/color-helpers/dist/index.mjs | 2 +- packages/color-helpers/scripts/hashes.json | 6 +++--- packages/color-helpers/src/conversions/lin-srgb.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/color-helpers/dist/index.cjs b/packages/color-helpers/dist/index.cjs index cf3e43108..ca6c274bf 100644 --- a/packages/color-helpers/dist/index.cjs +++ b/packages/color-helpers/dist/index.cjs @@ -41,7 +41,7 @@ * * @see https://en.wikipedia.org/wiki/SRGB */ -function lin_sRGB(t){return t.map((function(t){const _=t<0?-1:1,o=Math.abs(t);return o<.04045?t/12.92:_*Math.pow((o+.055)/1.055,2.4)}))} +function lin_sRGB(t){return t.map((function(t){const _=t<0?-1:1,o=Math.abs(t);return o<=.04045?t/12.92:_*Math.pow((o+.055)/1.055,2.4)}))} /** * Simple matrix (and vector) multiplication * Warning: No error handling for incompatible dimensions! diff --git a/packages/color-helpers/dist/index.mjs b/packages/color-helpers/dist/index.mjs index 9a1bb789f..5d1c126ab 100644 --- a/packages/color-helpers/dist/index.mjs +++ b/packages/color-helpers/dist/index.mjs @@ -41,7 +41,7 @@ function clip(t){return t.map((t=>t<0?0:t>1?1:t))} * * @see https://en.wikipedia.org/wiki/SRGB */ -function lin_sRGB(t){return t.map((function(t){const _=t<0?-1:1,o=Math.abs(t);return o<.04045?t/12.92:_*Math.pow((o+.055)/1.055,2.4)}))} +function lin_sRGB(t){return t.map((function(t){const _=t<0?-1:1,o=Math.abs(t);return o<=.04045?t/12.92:_*Math.pow((o+.055)/1.055,2.4)}))} /** * Simple matrix (and vector) multiplication * Warning: No error handling for incompatible dimensions! diff --git a/packages/color-helpers/scripts/hashes.json b/packages/color-helpers/scripts/hashes.json index f4ac63379..bfe077293 100644 --- a/packages/color-helpers/scripts/hashes.json +++ b/packages/color-helpers/scripts/hashes.json @@ -1,8 +1,8 @@ [ "384d52db3fcd98381e18743e1eba590a", - "6014c79b98dfe166e3e02232d8c3beaa", + "f736dea5b83ebcd853449a02255f747e", "094c9859b0960c4e394947cc4832b54f", "c9e2f2a3b2cba543a01cb8aa5d77c04a", - "f28e9d179704b95a9cd40fbf5b5f1164", - "a0b388982712b1849c991ce0e323828e" + "840ef26f992267c924230a26f939eaad", + "f912dea8d7d9813556f3ece0730f5392" ] \ No newline at end of file diff --git a/packages/color-helpers/src/conversions/lin-srgb.ts b/packages/color-helpers/src/conversions/lin-srgb.ts index d15f81273..3068d80b1 100644 --- a/packages/color-helpers/src/conversions/lin-srgb.ts +++ b/packages/color-helpers/src/conversions/lin-srgb.ts @@ -18,7 +18,7 @@ export function lin_sRGB(RGB: Color): Color { const sign = val < 0 ? -1 : 1; const abs = Math.abs(val); - if (abs < 0.04045) { + if (abs <= 0.04045) { return val / 12.92; }