@@ 3113-3120 (lines=8) @@ | ||
3110 | return new Less_Tree_Dimension(Less_Parser::round($c['h'])); |
|
3111 | } |
|
3112 | ||
3113 | public function saturation($color = null){ |
|
3114 | if (!$color instanceof Less_Tree_Color) { |
|
3115 | throw new Less_Exception_Compiler('The first argument to saturation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3116 | } |
|
3117 | ||
3118 | $c = $color->toHSL(); |
|
3119 | return new Less_Tree_Dimension(Less_Parser::round($c['s'] * 100), '%'); |
|
3120 | } |
|
3121 | ||
3122 | public function lightness($color = null){ |
|
3123 | if (!$color instanceof Less_Tree_Color) { |
|
@@ 3122-3129 (lines=8) @@ | ||
3119 | return new Less_Tree_Dimension(Less_Parser::round($c['s'] * 100), '%'); |
|
3120 | } |
|
3121 | ||
3122 | public function lightness($color = null){ |
|
3123 | if (!$color instanceof Less_Tree_Color) { |
|
3124 | throw new Less_Exception_Compiler('The first argument to lightness must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3125 | } |
|
3126 | ||
3127 | $c = $color->toHSL(); |
|
3128 | return new Less_Tree_Dimension(Less_Parser::round($c['l'] * 100), '%'); |
|
3129 | } |
|
3130 | ||
3131 | public function hsvhue( $color = null ){ |
|
3132 | if (!$color instanceof Less_Tree_Color) { |
|
@@ 3141-3148 (lines=8) @@ | ||
3138 | } |
|
3139 | ||
3140 | ||
3141 | public function hsvsaturation( $color = null ){ |
|
3142 | if (!$color instanceof Less_Tree_Color) { |
|
3143 | throw new Less_Exception_Compiler('The first argument to hsvsaturation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3144 | } |
|
3145 | ||
3146 | $hsv = $color->toHSV(); |
|
3147 | return new Less_Tree_Dimension( Less_Parser::round($hsv['s'] * 100), '%' ); |
|
3148 | } |
|
3149 | ||
3150 | public function hsvvalue( $color = null ){ |
|
3151 | if (!$color instanceof Less_Tree_Color) { |
|
@@ 3150-3157 (lines=8) @@ | ||
3147 | return new Less_Tree_Dimension( Less_Parser::round($hsv['s'] * 100), '%' ); |
|
3148 | } |
|
3149 | ||
3150 | public function hsvvalue( $color = null ){ |
|
3151 | if (!$color instanceof Less_Tree_Color) { |
|
3152 | throw new Less_Exception_Compiler('The first argument to hsvvalue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3153 | } |
|
3154 | ||
3155 | $hsv = $color->toHSV(); |
|
3156 | return new Less_Tree_Dimension( Less_Parser::round($hsv['v'] * 100), '%' ); |
|
3157 | } |
|
3158 | ||
3159 | public function red($color = null) { |
|
3160 | if (!$color instanceof Less_Tree_Color) { |
|
@@ 3192-3198 (lines=7) @@ | ||
3189 | return new Less_Tree_Dimension($c['a']); |
|
3190 | } |
|
3191 | ||
3192 | public function luma ($color = null) { |
|
3193 | if (!$color instanceof Less_Tree_Color) { |
|
3194 | throw new Less_Exception_Compiler('The first argument to luma must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); |
|
3195 | } |
|
3196 | ||
3197 | return new Less_Tree_Dimension(Less_Parser::round( $color->luma() * $color->alpha * 100), '%'); |
|
3198 | } |
|
3199 | ||
3200 | public function luminance( $color = null ){ |
|
3201 | if (!$color instanceof Less_Tree_Color) { |