Question

ok So I have created a color scheme, to highlight certain parts of input data(text).

However i need to make a Legend , to tell the user what each color means. This is what i Have so far : ` /input/

<div style="text-color: hsl($col,35%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,45%, 50%);">/*input*/</div>

<div style="text-color: hsl($col,50%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,55%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,60%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,70%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,80%, 100%);">/*input*/</div>

    <div style="text-color: hsl($col,90%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,100%, 100%);">/*input*/</div>      

` where input- will be the label of the color e.g. this means strong result. $col is a variable that will change the color each time e.g. 0 = red, etc.

I need to know how to make the colors i have here into a legend , which be on a html page.

Any help please?

Thanks:)

Was it helpful?

Solution

I guess you are trying to replace your /input/ placeholders with the actual name of the color, ie maroon, black, yellow and so on. You will probably end up writing your own replacement codes. Color names are available here http://www.imagemagick.org/script/color.php or here http://www.w3schools.com/cssref/css_colornames.asp. If you have ImageMagick you could create single pixel images and use http://www.php.net/manual/en/imagickpixel.getcolorasstring.php to retrieve the colors name, as far as I remember - you should cache the result, though... I'm not aware of any other built-in functions, but you could check some class repositories like phpclasses.org.

Hope that helps, Stefan

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top