they must have done it like this
const knownColors = {
red: true,
orange: true,
// ...
};
if (knownColors[wordFromYourCode]) {
showColorPicker();
}
so words like toString
, constructor
, hasOwnProperty
, etc Object - JavaScript | MDN get detected as colors