@@ 3121-3128 (lines=8) @@ | ||
3118 | return new Less_Tree_Dimension(Less_Parser::round($c['h'])); |
|
3119 | } |
|
3120 | ||
3121 | public function saturation($color = null){ |
|
3122 | if (!$color instanceof Less_Tree_Color) { |
|
3123 | throw new Less_Exception_Compiler('The first argument to saturation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3124 | } |
|
3125 | ||
3126 | $c = $color->toHSL(); |
|
3127 | return new Less_Tree_Dimension(Less_Parser::round($c['s'] * 100), '%'); |
|
3128 | } |
|
3129 | ||
3130 | public function lightness($color = null){ |
|
3131 | if (!$color instanceof Less_Tree_Color) { |
|
@@ 3130-3137 (lines=8) @@ | ||
3127 | return new Less_Tree_Dimension(Less_Parser::round($c['s'] * 100), '%'); |
|
3128 | } |
|
3129 | ||
3130 | public function lightness($color = null){ |
|
3131 | if (!$color instanceof Less_Tree_Color) { |
|
3132 | throw new Less_Exception_Compiler('The first argument to lightness must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3133 | } |
|
3134 | ||
3135 | $c = $color->toHSL(); |
|
3136 | return new Less_Tree_Dimension(Less_Parser::round($c['l'] * 100), '%'); |
|
3137 | } |
|
3138 | ||
3139 | public function hsvhue( $color = null ){ |
|
3140 | if (!$color instanceof Less_Tree_Color) { |
|
@@ 3149-3156 (lines=8) @@ | ||
3146 | } |
|
3147 | ||
3148 | ||
3149 | public function hsvsaturation( $color = null ){ |
|
3150 | if (!$color instanceof Less_Tree_Color) { |
|
3151 | throw new Less_Exception_Compiler('The first argument to hsvsaturation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3152 | } |
|
3153 | ||
3154 | $hsv = $color->toHSV(); |
|
3155 | return new Less_Tree_Dimension( Less_Parser::round($hsv['s'] * 100), '%' ); |
|
3156 | } |
|
3157 | ||
3158 | public function hsvvalue( $color = null ){ |
|
3159 | if (!$color instanceof Less_Tree_Color) { |
|
@@ 3158-3165 (lines=8) @@ | ||
3155 | return new Less_Tree_Dimension( Less_Parser::round($hsv['s'] * 100), '%' ); |
|
3156 | } |
|
3157 | ||
3158 | public function hsvvalue( $color = null ){ |
|
3159 | if (!$color instanceof Less_Tree_Color) { |
|
3160 | throw new Less_Exception_Compiler('The first argument to hsvvalue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3161 | } |
|
3162 | ||
3163 | $hsv = $color->toHSV(); |
|
3164 | return new Less_Tree_Dimension( Less_Parser::round($hsv['v'] * 100), '%' ); |
|
3165 | } |
|
3166 | ||
3167 | public function red($color = null) { |
|
3168 | if (!$color instanceof Less_Tree_Color) { |
|
@@ 3200-3206 (lines=7) @@ | ||
3197 | return new Less_Tree_Dimension($c['a']); |
|
3198 | } |
|
3199 | ||
3200 | public function luma ($color = null) { |
|
3201 | if (!$color instanceof Less_Tree_Color) { |
|
3202 | throw new Less_Exception_Compiler('The first argument to luma must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3203 | } |
|
3204 | ||
3205 | return new Less_Tree_Dimension(Less_Parser::round( $color->luma() * $color->alpha * 100), '%'); |
|
3206 | } |
|
3207 | ||
3208 | public function luminance( $color = null ){ |
|
3209 | if (!$color instanceof Less_Tree_Color) { |