Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: A hierarchy of color (intensity)?

by Perl Mouse (Chaplain)
on Nov 22, 2005 at 10:18 UTC ( [id://510709]=note: print w/replies, xml ) Need Help??


in reply to A hierarchy of color (intensity)?

A way of doing that would be by using the following table:
NumberColour
000.00.00
25500.00.FF
51000.FF.FF
76500.FF.00
1020FF.FF.00
1275FF.FF.FF
1530FF.00.FF
1785FF.00.00
204000.00.00
Intermediate value are calculated by linear interpolation. This gives you 2040 different colours; nearby values are mapped to nearby numbers; and values far apart will have quite different values (with the caveat that the table above is cyclic). It shouldn't be too hard to turn this table into code.

If you just have 1000 numbers, multiply the numbers by 2 before consulting the above table, or just use a subset of the colours.

If you have a lot of numbers, much more numbers than there are different values, it probably pays to make a lookup table.

Perl --((8:>*

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://510709]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found