Script is not reading

Also, if you do need to use nested ifs, maybe it’s just preference, but I find it much easier to read when all the conditions and outputs align (and colours are in human-readable HSL):

if(lower({this.props.text}) = 'alert',		// red
	'hsl(7 95% 60%)',
if(lower({this.props.text}) = 'running',	// green
	'hsl(95 60% 60%)',
if(lower({this.props.text}) = 'not_entry',	// yellow
	'hsl(55 95% 60%)',
if(lower({this.props.text}) = 'entry',		// light blue
	'hsl(185 95% 60%)',

	'hsl(0 0% 60%)'							// default
))))

Of course, using magic colours like this is also a no-no and these should use css variables, and I much prefer to reference these inside p.styles and use the p style in the ui, as then they're selectable.

Also, I made an HSL cheat sheet to help remember the H values

1 Like