HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Natural colors (NCol) is an initiative from W3C
Natural colors (NCol) is an initiative from w3resource.
The system is designed to make it easier to select HTML colors.
NCol specifies colors using a color letter with a number to specify the distance (in percent) from the color.
R30 means 30% away from Red , moving towards Yellow. (In other words: Red with 30% Yellow)
Letter | Color | Hues |
---|---|---|
R | Red |
R
R25
R50
R75
|
Y | Yellow |
Y
Y25
Y50
Y75
|
G | Green |
G
G25
G50
G75
|
C | Cyan |
C
C25
C50
C75
|
B | Blue |
B
B25
B50
B75
|
M | Magenta |
M
M25
M50
M75
|
R | Y | G | C | B | M | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Color and distance can also be given in hues (0-360):
R = 000 | Y = 060 | G = 120 | C = 180 | B = 240 | M = 300 |
NCol is not supported in HTML, but it is very close to the new HWB color system suggested in CSS4.
While waiting for CSS4, you can include w3resource' Color library, and use NCol as an HTML attribute like this:
<div
data-w3-color="R50,50%,0">
<p>London is the capital city of England.
It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.</p>
</div>
<script src="/lib/w3color.js"></script>
The JavaScript library used in the example above can be downloaded from
Trying to explain colors using RGB or HEX notation is very difficult.
Can you tell what color rgb(199,21,133) is?
RGB is based on how to physically produce colors by mixing light sources.
Because of this, NCol makes it much easier to describe colors.
Natural colors were first described by Karl Ewald Konstantin Hering (Germany 1834 - 1918).
w3SetColorsByAttribute(); var btnclck = false; if (window.addEventListener) { window.addEventListener("mousedown", function () {btnclck = true; }); } else if (window.attachEvent) { window.attachEvent("onmousedown", function () {btnclck = true; }); } if (window.addEventListener) { window.addEventListener("mouseup", function () {btnclck = false; }); } else if (window.attachEvent) { window.attachEvent("onmouseup", function () {btnclck = false; }); } function tooltip(e, n) { var x; if (btnclck) { if (e == 0) { x = document.getElementById("hue01"); } if (e == 1) { x = document.getElementById("white01"); } if (e == 2) { x = document.getElementById("black01"); } x.value = n; setColor(x); } } function setColor(elmnt) { var ele, col, ncol, h, w, b, rgb, i, c, n, hue, step; h = document.getElementById("hue01"); w = document.getElementById("white01"); b = document.getElementById("black01"); if (parseInt(elmnt.value) < 0) {elmnt.value = "0";} if (Number(h.value)) { hue = h.value; } else { step = 0; c = h.value.substr(0, 1).toUpperCase(); if (c == "") {hue = 0; c = ""; n = ""; } if (c == "R") {hue = 0; } if (c == "Y") {hue = 60; } if (c == "G") {hue = 120; } if (c == "C") {hue = 180; } if (c == "B") {hue = 240; } if (c == "M") {hue = 300; } if (hue == undefined) { c = "R"; hue = 0; } n = h.value.substr(1); if (n == "") { step = 0; } else { if (n < 0) {n = 0; } if (n > 99) {n = 99; } if (!Number(n)) { hue = 0; n = ""; } else { step = Number(n); } } h.value = c.toUpperCase() + n; hue = parseInt(hue + (step * 0.6)); } if (elmnt.id == "hue01") { if (parseInt(elmnt.value) > 360) {elmnt.value = "360";} } else { if (parseInt(elmnt.value) > 100) {elmnt.value = "100";} } if (elmnt.id == "white01") { if (parseInt(w.value) + parseInt(b.value) > 100) { b.value = 100 - parseInt(w.value); } } if (elmnt.id == "black01") { if (parseInt(w.value) + parseInt(b.value) > 100) { w.value = 100 - parseInt(b.value); } } rgb = w3color("ncol(" + h.value + ", " + w.value + "%, " + b.value + "%)"); document.getElementById("result01").style.backgroundColor = rgb.toRgbString(); document.getElementById("hwb01").value = rgb.toNcolString(); document.getElementById("rgb01").innerHTML = rgb.toRgbString(); document.getElementById("hex01").innerHTML = rgb.toHexString(); document.getElementById("hsl01").innerHTML = rgb.toHslString(); c = "R"; n = -1; for (i = 0; i < 60; i++) { if (i == 10) {c = "Y"; n = -1; } if (i == 20) {c = "G"; n = -1; } if (i == 30) {c = "C"; n = -1; } if (i == 40) {c = "B"; n = -1; } if (i == 50) {c = "M"; n = -1; } n++; ncol = c + (n * 10); if (n == 0) {ncol = c; } if (document.getElementById("huepointer" + ncol)) {document.getElementById("huepointer" + ncol).style.display = "none"; } } drawWhiteTable(hue); drawBlackTable(hue); for (i = 0; i <= 100; i++) { if (document.getElementById("whitepointer" + i)) {document.getElementById("whitepointer" + i).style.display = "none"; } if (document.getElementById("blackpointer" + i)) {document.getElementById("blackpointer" + i).style.display = "none"; } } if (document.getElementById("huepointer" + h.value)) {document.getElementById("huepointer" + h.value).style.display = "inline"; } if (document.getElementById("whitepointer" + w.value)) {document.getElementById("whitepointer" + w.value).style.display = "inline"; } if (document.getElementById("blackpointer" + b.value)) {document.getElementById("blackpointer" + b.value).style.display = "inline"; } document.getElementById("linktocp").innerHTML = "