Hexadecimal Color Notation on the Web

When designing elements for your webpage, you will often be called upon to specify a color. For example, the code for a span shown below specifies that the color of the text within the span will be yellow.

Text

Colors can be specified according to their names, for example "yellow", "green", or "blue". In many cases, these simple color names will work. But what if you want to specify a more sophisticated color like "cornflowerblue"? A particular browser may not recognize a particular color name. It's more reliable to specify colors with an "RGB triplet".

An RGB triplet specifies a color based upon the amounts of red, green, and blue, on a scale from 0 to 255, required to create the color. For example, to create the color cornflowerblue you need red=100, green=149, and blue=237. We could then specify the color of the text within a span using the rgb function as shown below.

Text

This will work fine with style notation, but what if you want to use straight html. Html doesn't recognize the rgb function. In that case, you can specify color using "hexadecimal" notation. Whereas the decimal numbering system uses the characters 0 through 9 to get 10 values, the hexadecimal numbering system uses the characters 0 through f to get 16 values. (After 9 the characters a, b, c, d, e and f are used, as shown below.)

Decimal Hexidecimal Equivilants

dec hex

0 = 0

1 = 1

2 = 2

3 = 3

4 = 4

5 = 5

6 = 6

7 = 7

8 = 8

9 = 9

10 = A

11 = B

12 = C

13 = D

14 = E

15 = F

On first appearance, this looks pretty simple but you need two hexadecimal characters to represent all decimal values from 0 to 255. When you increment decimal 9 by 1, you change the 9 to 0 and put 1 in the ten's place. When you increment hexidecimal F by one, you change the F to 0 and put 1 in the "sixteens" place. Sometimes it's not easy to convert between decimal and hexadecimal in your head.

RGB Triplet for Cornflowerblue

color dec hex

red 100 64

green 149 95

blue 237 ED

We could then specify the color of text within a span using the hexadecimal notation as shown below.

Text

Note that when we indicate the use of hexadecimal notation by placing a pound (#) sign in front of the number, and we don't use commas to separate the color components.

If it's not easy to convert between decimal and hexadecimal in your head, then how do you do it? You can use a calculator that has a decimal to hexadecimal coversion function, or you can learn to think in hexadecimal. For example, what's the next number after CE? That would be CF. what's the next number after CF? That would be D0. Which hexadecimal number is higher 99 or B2? B2 would be higher than 99. It gets easier with experience.

Here's Java Script code for a simple decimal to hexidecimal color converter

function convert(decvalue)

{

var num = parseInt(decvalue);

if(num >= 0 && num < 256)

{

var hexnum = num.toString(16);

alert("#" + hexnum);

}

else {alert("Error!");}

}

It's important to use hexadecimal notation to specify colors when you use DHTML with visual effects, because to create a dynamic color change you have to increment or add a value to a color. The vast amount of color specification on webpages is in hexadecimal notation, so it would be wise to become familiar with it.

Copyright(C) Bucaro TecHelp.

Permission is granted for the below article to forward, reprint, distribute, use for ezine, newsletter, website, offer as free bonus or part of a product for sale as long as no changes are made and the byline, copyright, and the resource box below is included.

About The Author

To learn how to maintain your computer and use it more effectively to design a Web site and make money on the Web visit bucarotechelp.com. To subscribe to Bucaro TecHelp Newsletter visit bucarotechelp.com

Culver prom limo ..
In The News:

An artificial intelligence-powered home security system can fire paintballs and tear gas at trespassers. The camera identifies human faces and animals.
Technology expert Kim Komando gives her tips and tricks on enhancing your user experience a smartphone and other devices you use everyday.
A new camera called NUCA uses artificial intelligence to create deepfake photos of subjects by stripping away clothing in close to real time.
The Kimberley Kube trail-ready camper has a compact but spacious design and combines luxury, functionality and ruggedness for a weekend getaway.
Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
Emails instructing you to reset your password for an account may be legitimate, or they may be scams. Kurt "CyberGuy" Knutsson explains.
Northrop Grumman's Manta Ray uncrewed underwater vehicle aims to revolutionize undersea missions — it glides through the ocean without human assistance.
Learn how to work Google's calendar application to streamline and organize your daily tasks from technology expert Kim Komando.
If you do not want Facebook to have automatic access to your private photos, follow our tips to protect yourself. Kurt “CyberGuy" Knutsson shows you how.
Kurt “CyberGuy" Knutsson goes into detail about Apple’s recent iOS update that allows iPhone users to instantly translate spoken language simply by using the Action Button.
Safeguarding your digital life with a reliable physical backup isn't just a precaution, it's a necessity. Kurt “CyberGuy" Knutsson provides the essential backup checklist.
Kurt “CyberGuy" Knutsson reveals how a Redditor exposed false recycling claims at their apartment, highlighting a report that only 21% of U.S. recyclables are processed.
Kurt "CyberGuy" Knutsson offers a travel toolkit featuring five technology tools to help you with booking flights and hotels for your summer vacation.
The bubble behind the clock on your iPhone can appear in different colors. Kurt "CyberGuy" Knutsson explains what each of those colors mean.
Scammers are using the power of artificial intelligence to mimic voices of people and are using the fake voices to commit crimes, like kidnappings.
Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
Tech guru Kurt "CyberGuy" Knutsson explains the science behind the Invisibility Shield, a 6-foot shield that makes people become invisible.
The International Olympic Committee on Friday announced plans to use AI in various Olympic aspects, including athlete identification, training and judging.
Tech guru Kurt "CyberGuy" Knutsson explains an easy trick to avoid squinting while working or surfing the web by zooming in on your personal computer.
Streaming giant Roku has recently been targeted by a pair of cyberattacks, and the company confirmed over a half million Roku accounts were compromised.
The Land Aircraft Carrier combines an all-terrain, six-wheeled vehicle with a two-seat aircraft, which features electric vertical takeoff and landing.
The European Union has sent TikTok a "request for information" on the video sharing platform's newest app, TikTok Lite, under the Digital Services Act, with the aim to clean up social media.
Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
The FBI is warning the public about a recent phishing scam via text that claims its targets owe money in Pennsylvania for unpaid road toll charges.
Your Apple Music settings may be revealing to your contacts what you're listening to. Kurt "CyberGuy" Knutsson explains the process to change those settings.

Give People What They Want And Watch Your Profits Soar!

Do you know why the majority of people use the... Read More

No Matr How Goud The Infomation...

Typos, misspellings, hideous grammar, exclamation overkill and run-on sentences all... Read More

8 Tips for Designing a Great Website

Square buttons, round buttons, flashy buttons ? will they match... Read More

How to Design Website Which Google Likes

Are you going to design or redesign new website or... Read More

Choosing the Right Web Designer

Creating your web site can be a tricky process. Choosing... Read More

Browser Compatibility

Internet Explorer, created by microsoft has been the most popular... Read More

Does Your Website Induce Seizures?

QUESTION: We promote our web site in all our... Read More

Maximising Web Site Viewability - Resolution

This is my second article on maximising web site viewability.... Read More

Web Design Tips To Boost Your Sales

The way you design your web site affects your visitors'... Read More

When Your Graphic Designer Costs You Money

So how do you know when your graphic designer costs... Read More

7 Reasons Why Using CSS is a Must

CSS is a new option for website designers that have... Read More

Eight Website Pitfalls, and How to Avoid Them

Clutter: Too much noise, too much text, and too little... Read More

So Much About META Tags!

I've written about META tags in the past, and I... Read More

Web Usability: The Basics

What is web usability & why is it important?Web usability... Read More

Is Your Site Too Slow? Why Image Optimization Is Critical

Graphics are fun, but if you put in too many... Read More

Make Your Web Site User-Friendly

You can create a website that attracts customers, not repels... Read More

Content is Crucial!

Content is undoubtedly the most important element of a website.... Read More

Building An Effective Furniture Sales Web Site

Web sites that feature products ? especially furniture or other... Read More

Do Your Website Yourself - 4 Simple Steps to Get Your Dreams on the Web

Many people hire professional web site designers for as much... Read More

The Top 8 Website Sins Part One

They say the eyes are the window to the soul.... Read More

Why Ugly Sites Sell More Than Pretty Ones

What the heck is going on lately? Most internet websites... Read More

Effective Web Design Usability Principles

Website Design Usability Tips1. Getting to know about audience membersYou... Read More

Is Your Web Site Turning Visitors Away?

One of the biggest problems with Web sites is that... Read More

How To Boost Your Sales Dramatically Using Dynamic Back-end Strategies

Getting a customer is not easy.Getting a visitor to decide... Read More

TEN Answers That Turn Your Visitors Into Your Customers

You know... Before purchasing your product a person comes to... Read More

Wood Dale limo ..