Codacy cleanup.
This commit is contained in:
parent
b1aec2c146
commit
5d5af55cdd
@ -334,7 +334,8 @@ class Tasks extends BaseController {
|
||||
$task = R::load('task', $taskId);
|
||||
$diff = (float)$beforePoints - (float)$afterPoints;
|
||||
|
||||
// Steps should be between -255 and 255. Negative = darker, positive = lighter
|
||||
// Steps should be between -255 and 255.
|
||||
// Negative = darker, positive = lighter
|
||||
$steps = max(-255, min(255, $diff * 10));
|
||||
|
||||
// Normalize into a six character long hex string
|
||||
@ -351,9 +352,12 @@ class Tasks extends BaseController {
|
||||
$newColor = '#';
|
||||
|
||||
foreach ($colorParts as $color) {
|
||||
$color = hexdec($color); // Convert to decimal
|
||||
$color = max(0,min(255,$color + $steps)); // Adjust color
|
||||
$newColor .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
|
||||
// Convert to decimal
|
||||
$color = hexdec($color);
|
||||
// Adjust color
|
||||
$color = max(0, min(255, $color + $steps));
|
||||
// Make two char hex code
|
||||
$newColor .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
$task->color = $newColor;
|
||||
|
||||
Reference in New Issue
Block a user