/** * Adjusts brightness of the $hex color. * * @param string $hex The hex value of a color * @param integer $steps should be between -255 and 255. Negative = darker, positive = lighter * @return string returns hex color */ public static function adjust_brightness($hex, $steps) { $color_obj = new self($hex); $steps_percent = round($steps * 100 / 255, 2); $new_color = $color_obj->color->incrementLightness($steps_percent); $new_color_obj = new Jetpack_Color($new_color); return self::sanitize_hex($new_color_obj->toCSS('hex')); }