Widget:Farbwähler
Aus KGS-Wiki
<input type="color" id="picker" value="#c0ffee" onchange="refreshLabel()"/><label for="picker" id="picklabel" style="padding-left: 5px;">Gewählte Farbe: 192, 255, 238 (#C0FFEE
)</label>
<script>
function refreshLabel() {
var color = document.getElementById('picker').value;
var r = parseInt(color.substr(1,2),16);
var g = parseInt(color.substr(3,2),16);
var b = parseInt(color.substr(5,2),16);
document.getElementById('picklabel').innerHTML = "Gewählte Farbe: " + r + ", " + g + ", " + b + " (" + color + "
)";
} </script>