From 60d0d4750ae334f7cfbcc6df68a4c6a174c0b8b5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 8 Sep 2023 16:40:33 +0200 Subject: [PATCH] Fix an error in the RGB to HSL conversion --- ts/WoltLabSuite/Core/ColorUtil.ts | 2 +- wcfsetup/install/files/js/WoltLabSuite/Core/ColorUtil.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/WoltLabSuite/Core/ColorUtil.ts b/ts/WoltLabSuite/Core/ColorUtil.ts index fb4ce0a027..a5af711c19 100644 --- a/ts/WoltLabSuite/Core/ColorUtil.ts +++ b/ts/WoltLabSuite/Core/ColorUtil.ts @@ -144,7 +144,7 @@ export function rgbToHsl(r: number, g: number, b: number): HSL { const l = (max + min) / 2; - if (max === 0) { + if (diff === 0) { s = 0; } else { s = diff / (1 - Math.abs(2 * l - 1)); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/ColorUtil.js b/wcfsetup/install/files/js/WoltLabSuite/Core/ColorUtil.js index 067b41f563..9b31e1f6ca 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/ColorUtil.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/ColorUtil.js @@ -126,7 +126,7 @@ define(["require", "exports"], function (require, exports) { } } const l = (max + min) / 2; - if (max === 0) { + if (diff === 0) { s = 0; } else { -- 2.20.1