From 4da56575c292a59e153959d3bb918cfc040b4b02 Mon Sep 17 00:00:00 2001 From: ShareVB Date: Sun, 29 Nov 2026 21:35:50 +0100 Subject: [PATCH] fix(Fortune Wheel): some string hashcode Fix #597 --- src/tools/fortune-wheel/fortune-wheel.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/fortune-wheel/fortune-wheel.vue b/src/tools/fortune-wheel/fortune-wheel.vue index 21ddfcf4..cc9c48ba 100644 --- a/src/tools/fortune-wheel/fortune-wheel.vue +++ b/src/tools/fortune-wheel/fortune-wheel.vue @@ -60,7 +60,7 @@ function getContrastColor(hue: number, saturation: number, lightness: number): s const m = l - c / 2; // Compact RGB calculation using array indexing - const hueSegment = Math.floor(h * 6); + const hueSegment = Math.floor(Math.abs(h) * 6); const rgbValues = [ [c, x, 0], // 0-60° [x, c, 0], // 60-120° @@ -70,7 +70,7 @@ function getContrastColor(hue: number, saturation: number, lightness: number): s [c, 0, x], // 300-360° ]; - const [r, g, b] = rgbValues[hueSegment].map((val) => (val + m) * 255); + const [r, g, b] = rgbValues[hueSegment % 6].map((val) => (val + m) * 255); // Calculate relative luminance and return appropriate contrast color const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;