Scaffold icon indicating copy to clipboard operation
Scaffold copied to clipboard

A more generic Color extension

Open jide opened this issue 15 years ago • 2 comments

I see the rewrite has made a lot of progress, and it's brilliant ! I can't wait for the functions to be implemented.

Using Scaffold a lot these times, I was thinking that a generic Color class would be a great thing to have. What I mean by "generic" is a function that would let us manipulate and convert colors from one single function. It would take a color as input, have an output format and return the reformatted color.

This would give "color input" -> "color output" :

background: color(#FF0000, rgb); // would output rgb(XXX, XXX, XXX); background: color(rgb(250, 134, 155), hex); // would output #XXXXXX; background: color(hsla(250, 134, 155, 80), rgba); // would output rgba(XXX, XXX, XXX, XXX); background: color(rgba(250, 134, 155, 50), image); // would output url(path/to/transparent-image.png); and so on...

Another thing that could be great would be the ability to manipulate those colors using rgb or hsl :

background: color(hsl-adjust(#FF0000, +10, -10, +20), rgb); background: color(rgb-adjust(#FF0000, +100, -50, +20), hex);

The implementation is to be thought a little more obviously, but you get the idea. Maybe it could be pluggable to handle some more cases.

Any thought ?

jide avatar Aug 13 '10 09:08 jide

I already implemented a hsl-adjust method for the previous version of Scaffold, and I may actually be able to help here.

jide avatar Aug 13 '10 09:08 jide

Sounds great. +1

balupton avatar Aug 20 '10 05:08 balupton