コード例 #1
0
    /**
     * 
     * draw color picker input
     */
    protected function drawColorPickerInput($setting)
    {
        $bgcolor = $setting["value"];
        $bgcolor = str_replace("0x", "#", $bgcolor);
        // set the forent color (by black and white value)
        $rgb = UniteFunctionsBiz::html2rgb($bgcolor);
        $bw = UniteFunctionsBiz::yiq($rgb[0], $rgb[1], $rgb[2]);
        $color = "#000000";
        if ($bw < 128) {
            $color = "#ffffff";
        }
        $disabled = "";
        if (isset($setting["disabled"])) {
            $color = "";
            $disabled = 'disabled="disabled"';
        }
        $style = "style='background-color:{$bgcolor};color:{$color}'";
        ?>
				<input type="text" class="inputColorPicker" id="<?php 
        echo $setting["id"];
        ?>
" <?php 
        echo $style;
        ?>
 name="<?php 
        echo $setting["name"];
        ?>
" value="<?php 
        echo $bgcolor;
        ?>
" <?php 
        echo $disabled;
        ?>
></input>
			<?php 
    }