RGB background, color and value set

Same BG and color as hex elem, but value is set the hex BG value with
whitespace removed
This commit is contained in:
Matt Pass
2013-05-23 17:49:31 +01:00
parent c18630b0a5
commit a95e4124a8

View File

@@ -164,8 +164,9 @@ _farbtastic = function (container, callback) {
// Linked elements or callback
if (typeof fb.callback == 'object') {
// Set background/foreground color
document.getElementById(fb.callback.id).style.backgroundColor = fb.color;
document.getElementById(fb.callback.id).style.color = fb.hsl[2] > 0.5 ? '#000' : '#fff';
document.getElementById(fb.callback.id).style.backgroundColor = document.getElementById(fb.callback.id + 'RGB').style.backgroundColor = fb.color;
document.getElementById(fb.callback.id).style.color = document.getElementById(fb.callback.id + 'RGB').style.color = fb.hsl[2] > 0.5 ? '#000' : '#fff';
document.getElementById('colorRGB').value = document.getElementById(fb.callback.id).style.backgroundColor.replace(/\s/g,'');
// Change linked value
if (callback.value && callback.value != fb.color) {