/**
  * Display the color and allow the user to edit it
  * @param string $value The value to decorate Don't forget to html-purify. 
  * @param boolean $full false if you want only the decoration
  * @return string html
  */
 public function decorateEdit()
 {
     $html = '';
     $hexa = ColorHelper::RGBToHexa($this->r, $this->g, $this->b);
     $id = 'decorator_' . $this->field_id . '_' . $this->value_id;
     $html .= self::fetchSquareColor($id, $hexa, 'colorpicker', $this->r, $this->g, $this->b);
     $html .= '<input id="' . $id . '_field" type="text" size="6" autocomplete="off" name="bind[decorator][' . $this->value_id . ']" value="' . $hexa . '" />';
     return $html;
 }
コード例 #2
0
 /** @return string hexadecimal representation of the color */
 private function getHexaColor($color)
 {
     return ColorHelper::RGBToHexa($color[0], $color[1], $color[2]);
 }
コード例 #3
0
 function testRGBToHexa()
 {
     foreach ($this->colorSet as $hexa => $rgb) {
         $this->assertEqual($hexa, ColorHelper::RGBToHexa($rgb[0], $rgb[1], $rgb[2]));
     }
 }