protected function constructHTML($color)
    {
        if (strlen($color) == 3) {
            $red   = str_repeat(substr($color, 0, 1), 2);
            $green = str_repeat(substr($color, 1, 1), 2);
            $blue  = str_repeat(substr($color, 2, 1), 2);
        } else {
            $red   = substr($color, 0, 2);
            $green = substr($color, 2, 2);
            $blue  = substr($color, 4, 2);
        }

        $this->r = hexdec($red);
        $this->g = hexdec($green);
        $this->b = hexdec($blue);
    }
protected function constructHTML($color)
    {
        if (strlen($color) == 3) {
            $red   = str_repeat(substr($color, 0, 1), 2);
            $green = str_repeat(substr($color, 1, 1), 2);
            $blue  = str_repeat(substr($color, 2, 1), 2);
        } else {
            $red   = substr($color, 0, 2);
            $green = substr($color, 2, 2);
            $blue  = substr($color, 4, 2);
        }

        $this->r = hexdec($red);
        $this->g = hexdec($green);
        $this->b = hexdec($blue);
    }
protected function constructHTML ( $ color ) { if ( strlen ( $ color ) == 3 ) { $ red = str_repeat ( substr ( $ color , 0 , 1 ) , 2 ) ; $ green = str_repeat ( substr ( $ color , 1 , 1 ) , 2 ) ; $ blue = str_repeat ( substr ( $ color , 2 , 1 ) , 2 ) ; } else { $ red = substr ( $ color , 0 , 2 ) ; $ green = substr ( $ color , 2 , 2 ) ; $ blue = substr ( $ color , 4 , 2 ) ; } $ this -> r = hexdec ( $ red ) ; $ this -> g = hexdec ( $ green ) ; $ this -> b = hexdec ( $ blue ) ; }
Construct from an html hex color code

@param string $color
Construct from an html hex color code