HTML/Javascript Colour Name Translation into RGB Tutorial

HTML/Javascript Colour Name Translation into RGB Tutorial

HTML/Javascript Colour Name Translation into RGB Tutorial

Sometimes you know a colour by a name, and perhaps that name is recognised as an RGB type of colour. Today we write some HTML and Javascript code, which, admittedly, does not work for all the web browsers (notably (not) Firefox) but will work in Safari or Google Chrome or Opera to tell you this web analysis of a colour name’s RGB makeup.

This brings into play the 16 default web colours (you can read about here at Wikipedia … thanks) namely …

CSS 1–2.0 / HTML 3.2–4 / VGA color names
Name Hex (RGB)
White #FFFFFF
Silver #C0C0C0
Gray #808080
Black #000000
Red #FF0000
Maroon #800000
Yellow #FFFF00
Olive #808000
Lime #00FF00
Green #008000
Aqua #00FFFF
Teal #008080
Blue #0000FF
Navy #000080
Fuchsia #FF00FF
Purple #800080

… because the method to translate these 16 default colours needs to be separated into a separate (mapping) lookup piece of logic, rather than letting the web browser (and Javascript DOM) do the work.

So please feel free to download the HTML and Javascript code you could call colour_translation.html or try the live run, and see you round … like a rissole (chortle … chortle).

If this was interesting you may be interested in this too.

This entry was posted in eLearning, Tutorials and tagged , , , , , , , . Bookmark the permalink.

7 Responses to HTML/Javascript Colour Name Translation into RGB Tutorial

  1. Ward Lucis says:

    I like this post, enjoyed this one regards for posting. “No trumpets sound when the important decisions of our life are made. Destiny is made known silently.” by Agnes de Mille.

  2. thrilling says:

    I gotta bookmark this internet site it seems very helpful extremely helpful

  3. I’ve been absent for some time, but now I remember why I used to love this site. Thank you, I‘¦ll try and check back more often. How frequently you update your website?

  4. I have to express my thanks to you for rescuing me from this type of incident. Just after looking out throughout the internet and getting views that were not helpful, I was thinking my life was gone. Existing minus the strategies to the problems you’ve fixed through your article content is a crucial case, as well as those which might have badly damaged my entire career if I hadn’t discovered your blog post. Your own personal mastery and kindness in playing with everything was vital. I don’t know what I would have done if I hadn’t discovered such a point like this. I can at this time relish my future. Thank you so much for the specialized and amazing help. I won’t hesitate to propose your web site to any person who ought to have direction about this area.

  5. Some really great articles on this web site , thanks for contribution.

Leave a Reply to casareparacoes24h.pt Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>