Carpet

Carpet

2M Downloads

[Scarpet suggestion] color() method for converting colors

replaceitem opened this issue ยท 5 comments

commented

A function for conveting colors from various color models, for example:
color('rgb','hex',[255,128,0]) returns the color in hex as a string : #FF8000
or
color('hsb','hex',[40,128,0]) converts from hue, saturation and brightnes to a hex string
or
color('hex','rgb','#22FF00') converts from hex string to a list of red, green and blue values

This would be usefull for the format() function:

format(str('%s Test',color('rgb','hex',255,128,32)))

commented

Im relatively sertain that is already possible with existing scarpet, but lemme check

commented

It surely is with maths, but thats a lof of work, especially converting with hue saturation and brightnes, it would be much sinpler to just use a function, that uses javas converting functions

commented

like a library app

commented

unless you have it in a separate library

commented

Nah, it introduces more complexity that it really helps imo. Agree with Ghoulboy - you can write your own function that formats it.