protected function _renderVarInput_colorpicker($form, &$var, &$vars)
{
global $registry, $browser;
$varname = $this->_genID($var->getVarName(), false);
$color = $var->getValue($vars);
if ($color) {
$style = ' style="background-color:' . $color . ';color:' . (Horde_Image::brightness($color) < 128 ? '#fff' : '#000') . '"';
} else {
$style = '';
}
$html = '<table cellspacing="0"><tr><td>' . '<input type="text" size="10" maxlength="7" name="' . htmlspecialchars($var->getVarName()) . '" id="' . $varname . '"' . $style . ' value="' . htmlspecialchars($color) . '" /></td>';
if ($browser->hasFeature('javascript')) {
$GLOBALS['injector']->getInstance('Horde_PageOutput')->addScriptFile('colorpicker.js', 'horde');
$html .= '<td>' . Horde::link('#', Horde_Core_Translation::t("Color Picker"), '', '', 'new ColorPicker({ color: \'' . htmlspecialchars($color) . '\', offsetParent: Event.element(event), update: [[\'' . $varname . '\', \'value\'], [\'' . $varname . '\', \'background\']] }); return false;') . Horde::img('colorpicker.png', Horde_Core_Translation::t("Color Picker"), 'height="16"') . '</a></td>';
}
return $html . '</tr></table>';
}