From 1d991c93e0c8e4cfa11afae844ad4e01c6d1bb04 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Tue, 4 Feb 2025 21:55:48 -0700 Subject: [PATCH] color: fix some colornames logic with valid colors --- src/modules/misc/color.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/misc/color.js b/src/modules/misc/color.js index 571d47d..fd69107 100644 --- a/src/modules/misc/color.js +++ b/src/modules/misc/color.js @@ -24,10 +24,10 @@ color.callback = async function (msg, line, args, {truerandom, first}) { } if (!color.isValid) { - const search = `^([0-9a-f]{6}),${query},`; + const search = `^([0-9a-f]{6}),${color.toHexString().substring(1)},`; if (!first) { const colornamesMatches = colornamesRaw.match(new RegExp(search, "img")); - if (colornamesMatches.length > 1) { + if (colornamesMatches?.length > 1) { const hexes = colornamesMatches.map((m) => m.split(",")[0]); const random = hexes[Math.floor(Math.random() * hexes.length)];