Example #1
0
 public function color($n)
 {
     if ($n instanceof Less_Tree_Quoted) {
         $colorCandidate = $n->value;
         $returnColor = Less_Tree_Color::fromKeyword($colorCandidate);
         if ($returnColor) {
             return $returnColor;
         }
         if (preg_match('/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/', $colorCandidate)) {
             return new Less_Tree_Color(substr($colorCandidate, 1));
         }
         throw new Less_Exception_Compiler("argument must be a color keyword or 3/6 digit hex e.g. #FFF");
     } else {
         throw new Less_Exception_Compiler("argument must be a string");
     }
 }