Problem
When using the get.rgb() function with a named color, the returned array is a reference to the underlying mapped colorName to array representation while it should be a copy to it. This creates bugs when you manipulate the result you get from the function, any modification to that result also modified all the returned values from the get.rgb() function when you call it with the same named color.
Steps to reproduce
import colorString from "color-string";
const col1 = colorString.get.rgb("red"); // [255, 0, 0, 1]
console.log("col1:", col1);
col1[0] = 0; // now [0, 0, 0, 1]
console.log("col1 after modification", col1);
const col2 = colorString.get.rgb("red"); // returns [0, 0, 0, 1] while it should be [255, 0, 0, 1]
console.log("col2:", col2);
All the tests have been done on
Window 11 Home 24H2
node v24.1.0 on PowerShell