src/includes/classes/Core/Utils/Color.php
public function adjustLuminosity(string $hex, float $adjust): string
    {
        $hex = $this->cleanHex($hex);

        for ($adjusted_hex = '', $_dec, $_hex, $_i = 0; $_i < 3; ++$_i) {
            $_dec = hexdec(mb_substr($hex, $_i * 2, 2));
            $_hex = dechex(round(min(max(0, $_dec + ($_dec * $adjust)), 255)));
            $adjusted_hex .= $this->c::mbStrPad($_hex, 2, '0', STR_PAD_LEFT);
        } // unset($_dec, $_hex, $_i); // Housekeeping.

        return '#'.$adjusted_hex;
    }
public function adjustLuminosity(string $hex, float $adjust): string
    {
        $hex = $this->cleanHex($hex);

        for ($adjusted_hex = '', $_dec, $_hex, $_i = 0; $_i < 3; ++$_i) {
            $_dec = hexdec(mb_substr($hex, $_i * 2, 2));
            $_hex = dechex(round(min(max(0, $_dec + ($_dec * $adjust)), 255)));
            $adjusted_hex .= $this->c::mbStrPad($_hex, 2, '0', STR_PAD_LEFT);
        } // unset($_dec, $_hex, $_i); // Housekeeping.

        return '#'.$adjusted_hex;
    }
Adjust luminosity.

@since 161010 Color utilities.

@param string $hex    Hex color code to adjust.
@param float  $adjust `-0.5` (50% darker), `0.5` (50% ligher).

@return string Adjusted hex color, +- luminosity.

@see https://www.sitepoint.com/javascript-generate-lighter-darker-color/