Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Converting hex colors to color safe hex

by radiantmatrix (Parson)
on Apr 11, 2008 at 16:22 UTC ( #679741=note: print w/replies, xml ) Need Help??


in reply to Converting hex colors to color safe hex

Do you perhaps mean "web safe" instead of "color safe"? If so, it's a pretty easy approach.

Each element of the color is 1 byte (0-255 unsigned), and expressed in hex. All you have to do is round the values of each byte to the nearest in the "web safe" color chart. (with some bounds-checking, of course).

Show us some code on what you've tried, perhaps trying to implement that kind of solution, and you'll get better help. Check out How (Not) To Ask A Question for tips on getting the best help here.

<radiant.matrix>
Ramblings and references
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet
  • Comment on Re: Converting hex colors to color safe hex

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://679741]
help
Chatterbox?
[Discipulus]: finally a relaxing workday! good morning mnks!
[Lady_Aleena]: I hope you have a wonderful day Discipulus. 8)
[Corion]: A good morning to you too ;)
[choroba]: Good morning, Monks!
[Corion]: And a good daypart to you as well, Lady_Aleena !
[robby_dobby]: Hey monkeys, do you ever get the realization that you're all waking up to chaos? I suppose not :P

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-05-29 07:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?