diff --git a/farbtastic/farbtastic.js b/farbtastic/farbtastic.js index 4f70d44..9e1bb0d 100644 --- a/farbtastic/farbtastic.js +++ b/farbtastic/farbtastic.js @@ -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) {