misc.color: link to colornames page for the color instead of homepage

This commit is contained in:
Cynthia Foxwell 2024-07-31 21:49:57 -06:00
parent 3d06d43131
commit 5248ef1f75

View file

@ -663,7 +663,8 @@ color.callback = async function (msg, line, args, {truerandom}) {
})
.png()
.toBuffer();
const fileName = `${color.toHex()}.png`;
const hex = color.toHex();
const fileName = `${hex}.png`;
const fields = [
{
@ -701,9 +702,12 @@ color.callback = async function (msg, line, args, {truerandom}) {
});
}
const colornamesName = colornamesRaw.match(new RegExp(`^${color.toHex()},([^,]+?),`, "im"))?.[1];
const colornamesName = colornamesRaw.match(new RegExp(`^${hex},([^,]+?),`, "im"))?.[1];
if (colornamesName) {
fields.push({name: "\u200b", value: `**[colornames](https://colornames.org/) Name**\n${colornamesName}`});
fields.push({
name: "\u200b",
value: `**[colornames](https://colornames.org/color/${hex}) Name**\n${colornamesName}`,
});
}
return {