Forum Moderators: open

Message Too Old, No Replies

Using Hex Colors

How do you interpret them?

         

MatthewHSE

2:56 am on Nov 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Back when I started web design, about two years ago, I bought and installed MS FrontPage (go ahead and laugh). Then, about a year ago, I gave up FP for EditPad. How free I felt to give up the point-and-click in favor of plain text!

But, when I started using CSS about four months ago, and needed to use hex colors, I found myself getting back into FrontPage for the sole purpose of using the hex color chooser.

However, that's very cumbersome, and I'd rather be able to simply say, "Oh, I'd like a light blue, I'll try cceeff." So my question is, how do you just find the hex color you want, without needing to use some visual aid?

lorax

3:17 am on Nov 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well I suppose if you were a mathemetician then you could easily think in hex and develop the colors without a visual aid but not me. I rely on the visual aids. Why wouldn't you want a visual aid? Or perhaps I'm not getting the gist of what you're aiming at?

keyplyr

3:30 am on Nov 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




I keep 4 different color chart webpages saved in my favorites. One of which is/should be MS websafe colors. Webmonkey is another, but many times I pull-out PhotoShop and reduce the window size to see how colors will look next to each other.

DrDoc

4:26 am on Nov 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can always save the color chooser spectrum thingy from Photoshop (or some other program). Then download ColorPicker. It lets you grab and save colors from anywhere on the screen.

Otherwise... It's not THAT hard to get used to interpreting hex codes. Just remember that there are 16 digits (0-9A-F) and that the first two adjust the amount of red, the next two the amount of green, and the last two the amount of blue.

bunltd

4:45 am on Nov 25, 2003 (gmt 0)

10+ Year Member



Visibone has some nice charts/cards, an online color-picker that lets you see combinations, as well as downloads for popular software. For CSS I use TopStyle, it has several palettes choose from (web safe, named colors, visibone) Color-Picker is also a neat tool.

LisaB

Distel

10:51 am on Nov 25, 2003 (gmt 0)

10+ Year Member



You could also give RGBLab 20003 a try.

PCInk

11:06 am on Nov 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you know how to count in hex you can easily work it out. The format (6 digit) is Red, Red, Green, Green, Blue, Blue.

Hex goes from 0-9, then A-F. So when you get to 9, you don't carry the number over (as in 10), but you continue through A-F. When you get to 'F', then it carries over, so you add one to the digit in front and reset the one you have been incrementing (so it becomes 10). We do the same in decimal, but add and reset after 9 instead of F.

Therefore the maximum is 'FF' for a 2 digit colour. They are in the format RRGGBB. (Red, Green, Blue). So, FF0000 is red (all red on full, green and blue switched off).

Web safe colours generally have the values: FF, CC, 99, 66, 33 or 00. Using these, you will be able to get close, if you experiment a little, you'll soon get the hang of it. So, if you know you need bright red, medium blue, but zero green in your colour you could jump straight into FF0066.

If you've messed with RGB colours before, you'll get the idea quite quickly.

lorax

3:13 pm on Nov 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Another thought is that since you related your need to work with colors in CSS you might want to look into TopStyle Pro. It has a color selection tool that let's you choose colors visually for a style. The tool can give you preselected colors, harmonious matching colors, complimentary colors, websafe, or free-form color selection. I use it all the time for my CSS work.

MatthewHSE

3:23 pm on Nov 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the ideas everyone! I appreciate your insights.

baton

8:33 am on Nov 27, 2003 (gmt 0)

10+ Year Member



in fact if all u nead are colors from within CSS styles maybe consider using an rgb() function.. rgb (0-255, 0-255, 0-255) gives u a color not using hex if u'r afraid of it..

style=" background-color: rgb(255,0,0)" - works like red

Herenvardo

12:03 pm on Nov 29, 2003 (gmt 0)

10+ Year Member



I've been working with dreamweaver for a time and I found it's color picker very efficient:
All the websafe colors appear ordered by their Hexvalues. You can take a little visual help by making a chart like the one dw uses, something like that:
__FFCC99663300 -> Red 
FF
CC
99
66
33
00
Green

Then you make six charts: one for each safe value of blue, and fill them with the matching colors. Even it is visual, it works well. You can have it on-screen or print it to a sticky note and put it on your monitor. You will then look your chart for the color you like and retrieve the Hex values. I have been using it for a time and it works (at least for me).
Important: If you print the chart, modify the colors properly: many printers give colors different of the on-screen ones.
I hope this is useful.

Greetings,
Herenvardö

TryAgain

5:21 am on Dec 2, 2003 (gmt 0)

10+ Year Member



Ok so explain this to me; what's the hang-up about these "websafe colors"?

They are ugly!

I mean, you pretty much presume your visitors will be able to show some .jpg or .gif decently right? They (usually) use a much broader palet. So why restrict yourself to these bland "websafe colors" for text or whatever?

PCInk

9:29 am on Dec 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you use non-websafe colours in a graphical image, you will usually be OK. What happens is the computers (most do this) pick two colours that are similar, and alternately display each pixel in the two colours.

The same happens if you choose a non-web-safe colour over a large area. Sometimes the two colours it picks can be quite different and look awful. Put any text over that, and it can become very difficult to read it.

Web safe colours should be used for the fundemental colours on a site, whereas non-websafe colours should only be used in small areas, such as graphics.

Purple Martin

12:45 am on Dec 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In CSS, you can use a shorthand version of hex values that only has three digits: one for red, one for green, one for blue.

e.g.
#F00 = bright red
#060 = dark green

The handy thing about shorthand is it's always a websafe colour!

photon

1:43 pm on Dec 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not quite true. Web safe colors are those that hit every third hex number--0, 3, 6, 9, C, F. For example, #FF9933, #CC0066, etc. True, you can then shorten those to #F93 and #C06, respectively.

There are only 216 web safe colors. Every third hex number gives 6x6x6 = 216. If it were every hex color you'd have 16x16x16 = 4096 colors.

Purple Martin

7:54 am on Dec 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doh! Silly me. I'm just so used to using every third number/letter that it doesn't even occur to me to use any others.

Herenvardo

9:22 am on Dec 4, 2003 (gmt 0)

10+ Year Member



If it's usefull, I'll put a list of basic colors:
The standard 16color set (in the format #hhh) is:
#000 Black
#00F Blue (Electric)
#0F0 Green (Lime)
#0FF Cyan / Aquamarine
#F00 Red
#F0F Fuchsia
#FF0 Yellow
#FFF White
#999 Dark Grey (#888)
#009 Navy (Dark Blue) (#008)
#090 Green (Dark) (#080)
#099 Turquoise (#088)
#900 Brown (Dark Red) (#800)
#909 Purple (#808)
#990 Olive (#880)
#CCC Silver (Light Grey) (#DDD)

If you want to get a intermediate color, do it by arithmetics. For example: Orange is 50% Yellow + 50% Red, so you can make 0.5x#FF0 + 0.5x#F00 = #F80 ~ #F90 -> Orange
Remember to use only 0, 3, 6, 9, C and F if you want web-safe colors.

Greetings,
Herenvardö

TheDoctor

11:20 pm on Dec 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's also a piece of freeware called EyeDropper, which will convert a colour to its code - ie, find a colour you'd like to use, move the eye dropper frame across it, and you see the code displayed.

Code can be in hex or rgb format.

TheDave

11:51 pm on Dec 5, 2003 (gmt 0)

10+ Year Member



Make your own web-safe colour picker:

<table border=0 cellpadding=2 cellspacing=2 width=100%>
<script type="text/javascript">
<!--
var r = 0;
var g = 0;
var b = 0;

var hexs = new Array(6);

hexs[0] = "00";
hexs[1] = "33";
hexs[2] = "66";
hexs[3] = "99";
hexs[4] = "CC";
hexs[5] = "FF";

for(r = 0; r < 6; r+=1)
{
for(g = 0; g < 6; g+=1)
{
document.write("<tr>");
for(b = 0; b < 6; b+=1)
{
hexstr = hexs[r] + hexs[g] + hexs[b];
document.write("<td bgcolor='#"+hexstr+"'>"+hexstr+"</td>");
}
document.write("</tr>");
}
}
//-->
</script>
</table>

Ok, I'm just showing off ;)

Herenvardo

10:08 am on Dec 6, 2003 (gmt 0)

10+ Year Member



Good!
But there is a little problem: the text is unreadable over dark colors! :P Don't worry ;) if you select the table cell, you can view the code.
This is a improved version of my chart!

Greetings,
Herenvardö

TheDave

11:02 am on Dec 6, 2003 (gmt 0)

10+ Year Member



You can style the text inside cell with the inverse colour:

invhexstr = hexs[(5-r)] + hexs[(5-g)] + hexs[(5-b)];

then in the contents of the cell put:

"<a style='color:#"+invhexstr+"'>"+hexstr+"</a>"

:)

MatthewHSE

1:40 am on Dec 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



invhexstr = hexs[(5-r)] + hexs[(5-g)] + hexs[(5-b)];

then in the contents of the cell put:

"<a style='color:#"+invhexstr+"'>"+hexstr+"</a>"

How do you make that work? Meaning, where in the page do you put the first line?

TheDave

10:34 am on Dec 19, 2003 (gmt 0)

10+ Year Member



for(r = 0; r < 6; r+=1)
{
for(g = 0; g < 6; g+=1)
{
document.write("<tr>");
for(b = 0; b < 6; b+=1)
{
hexstr = hexs[r] + hexs[g] + hexs[b];
invhexstr = hexs[(5-r)] + hexs[(5-g)] + hexs[(5-b)];
document.write("<td bgcolor='#"+hexstr+"'>+"<a style='color:#"+invhexstr+"'>"+hexstr+"</a>"+</td>");
}
document.write("</tr>");
}
}

Mr_Brutal

10:59 am on Dec 19, 2003 (gmt 0)

10+ Year Member



Hi,

So if I found a colour using a colour dropper say:

#487F7C

and I wanted to find the nearest web safe equivelant I find the nearest 3rd multiple for each character:

#396F6C

Is that right?

victor

11:38 am on Dec 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not quite, Mr_Brutal.

There are only 216 web-safe colors. To be web-safe, both digits must be the same multiple of 3.

#396F6C would be #336666 or thereabouts

Mr_Brutal

11:40 am on Dec 19, 2003 (gmt 0)

10+ Year Member



Thanks Victor - I wasn't doing my maths quite as well as i thought.

bruhaha

2:33 pm on Dec 19, 2003 (gmt 0)

10+ Year Member



You can style the text inside cell with the inverse colour

I can't quite make this work. But there is another simple alternative. Place the text inside a span whose background-color is set to white.

document.write("<td bgcolor='#"+hexstr+"'><span style=background-color:#fff>"+hexstr+"</span></td>"); 

(You may also find this consistent black-on-white more readable and less distracting.)

choster

2:44 pm on Dec 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, there are 216 colors shared by Macintosh and Windows, but we're not supposed to call them websafe any more. See
hotwired.lycos.com/webmonkey/00/37/index2a.html .

TheDave

12:15 am on Dec 20, 2003 (gmt 0)

10+ Year Member



I can't quite make this work.

To be honest, I never tested it :P You could use a style tag within the td instead of bgcolor and set the font color there:

document.write("<td style='background-color:#"+hexstr+"; color:#"+invhexstr+"'>"+hexstr+"</td>");

Herenvardo

8:44 am on Dec 24, 2003 (gmt 0)

10+ Year Member



dave, there is a little new problem:
¿what is the inverse color of #999999? It would be something like #666666, but it is almost unreadable... what if you get a 50% grey? If you try to invert it, you will get the same color... There are many alternatives... Do as you like ;)
Greetings,
Herenvardö
This 34 message thread spans 2 pages: 34