{"id":9203,"date":"2017-10-23T00:01:05","date_gmt":"2017-10-23T07:01:05","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/?p=9203"},"modified":"2017-10-24T19:19:06","modified_gmt":"2017-10-25T02:19:06","slug":"chuck-norris-the-html-color","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=9203","title":{"rendered":"Chuck Norris, the HTML Color"},"content":{"rendered":"<p>A story appeared on <a href=\"https:\/\/stackoverflow.com\/questions\/8318911\/why-does-html-think-chucknorris-is-a-color#8333464\" target=_new>StackOverflow<\/a> about how Chuck Norris&#8217; name is an HTML color. It&#8217;s funny because, well, Chuck Norris his own superhuman <a href=\"https:\/\/www.google.com\/search?q=chuck+norris+meme&#038;tbm=isch&#038;tbo=u&#038;source=univ&#038;sa=X&#038;ved=0ahUKEwjFrfnW2fPWAhVD6IMKHV_gDuwQsAQIJw&#038;biw=1426&#038;bih=1152\" rel=\"noopener\" target=\"_blank\">meme<\/a>. But it&#8217;s also true because of the way HTML interprets color names.<br \/>\n<!--more--><br \/>\nHTML is the formatting language for web pages. It&#8217;s not a programming language, though many mistakenly refer to it as such. HTML sets out the way a page looks. It can be quite complex, especially when coupled with cascading style sheets (CSS) and JavaScript (which is a programming language), or it can be really simple. I once coded all my webpages using Windows Notepad because the HTML codes are easy to use and feedback is immediate.<\/p>\n<p>In HTML, colors are defined in two ways.<\/p>\n<p>The nerdy way is to set independent red, green, and blue values for the color. That sounds easy, but HTML uses hexadecimal values in a clutch of 3 or 6 digits. So a pure, red color is HTML color code <code>#FF0000<\/code> or <code>#F00<\/code>. That &#8220;number&#8221; is interpreted as red.<\/p>\n<p>The second, easier way is to use a color word. HTML defines specific color words, such as &#8220;red&#8221; or &#8220;green&#8221; or &#8220;pink,&#8221; which you can use instead of the color codes. <a href=\"http:\/\/htmlcolorcodes.com\/color-names\/\" rel=\"noopener\" target=\"_blank\">Click here<\/a> to view HTML color names.<\/p>\n<p>How &#8220;Chuck Norris&#8221; becomes a color is in the way HTML interprets color code words. If the word isn&#8217;t recognized, HTML slips back into the color code number interpretation. Valid code numbers are 0 through 9 and A through F. In the case of &#8220;Chuck Norris&#8221; (or any random text) invalid characters are interpreted as value 0. Therefore, &#8220;Chuck Norris&#8221; is transformed into a color code:<\/p>\n<p>&#8220;Chuck Norris&#8221; -&gt; &#8220;chucknorris&#8221; -&gt; C00C 0000 0000 -&gt; C0 00 00 -&gt; #C00000 -&gt; <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.wambooli.com\/blog\/wp-content\/uploads\/2017\/10\/chucknorris_color.png\" alt=\"\" width=\"100\" height=\"17\" class=\"alignnone size-full wp-image-9210\" \/><\/p>\n<p>This conversion doesn&#8217;t happy only to the might Mr. Norris. You can type your own name as an HTML color code and see what color you render as.<\/p>\n<p>Below is a gizmo I coded that lets you type in an HTML color or code &mdash; or your name (no spaces) &mdash; to see how HTML interprets it. Have fun.<\/p>\n<p><script type=\"application\/javascript\">\n\tfunction changec() {\n\t\tvar color = document.getElementById(\"colorname\");\n\t\tvar bar = document.getElementById(\"colorswatch\");\n\t\tbar.bgColor = color.value;\n\t}\n<\/script><\/p>\n<div align=\"center\">\n<table width=\"40%\">\n<tr>\n<td id=\"colorswatch\" bgcolor=\"red\" >&nbsp;<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">Color name: <input type=\"text\" id=\"colorname\"><\/td>\n<\/tr>\n<tr>\n<td align=\"center\"><input type=\"button\" value=\"Update Color\" onClick=\"changec();\"><\/td>\n<\/tr>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The superhero of mortal men, &#8220;Chuck Norris&#8221; is also a color code for HTML.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-9203","post","type-post","status-publish","format-standard","hentry","category-main"],"_links":{"self":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9203"}],"version-history":[{"count":12,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9203\/revisions"}],"predecessor-version":[{"id":9233,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9203\/revisions\/9233"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}