We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b205ad commit 2c71a6bCopy full SHA for 2c71a6b
lib/ColorThief/VBox.php
@@ -168,10 +168,11 @@ public function contains(array $rgbValue, $rshift = ColorThief::RSHIFT)
168
*/
169
public function longestAxis()
170
{
171
- $colorWidth['r'] = $this->r2 - $this->r1;
172
- $colorWidth['g'] = $this->g2 - $this->g1;
173
- $colorWidth['b'] = $this->b2 - $this->b1;
+ // Color-Width for RGB
+ $red = $this->r2 - $this->r1;
+ $green = $this->g2 - $this->g1;
174
+ $blue = $this->b2 - $this->b1;
175
- return array_search(max($colorWidth), $colorWidth);
176
+ return $red >= $green && $red >= $blue ? 'r' : ($green >= $red && $green >= $blue ? 'g' : 'b');
177
}
178
0 commit comments