Jump to content

Recommended Posts

I know how to write color codes and I know that I can find a million color codes on-line. Does anyone know if the default color codes for just typing a color is set by someone and where I could find them?

 

Examples:

black = #000000

white = #ffffff

pure blue = #0000ff

 

I'm looking for the default value for things like orange, gray, pink, purple, etc. Are they set on my computer based on what browser I have, based on what OS I have, etc.? I hope that none of that is confusing.

 

I found this page (http://www.w3schools.com/html/html_colornames.asp), and yeah it's by w3c, but it could just be someone else's opinion of what the color code should be. Could these be those default values that I'm looking for?

Link to comment
https://forums.phpfreaks.com/topic/62367-solved-hex-color-codes/
Share on other sites

There really aren't any.  What looks like orange to you looks like a red-orange to someone else and an yellow-orange to another person.  The 'named' colours are as standard as you're going to get and moderately useful, but hope you don't get too many clients who want "A nice blue, you know".  Nobody can confuse RGB notation (and the triplets can be compressed - #ff6600 is the same as #f60 (some kind of orange or other)

I understand and already know all of that. I just wanted to know where I can get the hex that is being used by typing out pink or purple. I want to get those colors and mess with them, but I can't figure out the hex values for them.

I guess not.

 

There are a million pages out there with people giving out codes for what they might think pink or purple is. I could find 10 different ways to show quote purple unquote. I just wasn't sure if that page was just another opinion of what they think the code should be. W3C is a pretty trusted site, but I didn't know if I needed to look somewhere else. Thanks.

AFAIK those are correct. If you are unsure you can always create a table with two columns side by side, on of the side fills in the background using the name of the color, eg bgcolor="blue" whilst the other columns use a hex for the background color bgcolor="#0000FF

 

That way you can visually compare the colour differences.

 

Heres a few random colors picked.

<style>
td {
    height: 30px;
    text-align: center;
}

</style>

<table border="0" cellspacing="3" cellpadding="0" width="500">
  <tr>
    <td width="33%">COLOR</td>
    <td width="33%"></td>
    <td width="33%">HEX</td>
  </tr>
<?php

$colors = array( 'Blue' => '#0000FF',
                 'AntiqueWhite' => '#FAEBD7',
                 'Chartreuse' => '#7FFF00',
                 'DarkGreen' => '#006400',
                 'Fuchsia' => '#FF00FF',
                 'LightSeaGreen' => '#20B2AA'
);

ksort($colors);

foreach($colors as $color => $hex)
{
    echo "  <tr>\n    ";
    echo '<td bgcolor="' . $color . '"></td>';
    echo '<td>' . $color . '</td>';
    echo '<td bgcolor="' . $hex . "\"></td>\n  </tr>\n";
}

?>
</table>

Could a video card, browser, or OS make those colors APPEAR different?

 

They would look differently, but the hex/rgb code would look like the "name" code. I.e. blue and #00f would look the same on the same monitor although it may look different on another monitor.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.