private function getLetterboxColor($letterboxDef): string
    {
        $color = $letterboxDef['color'];
        $opacity = $letterboxDef['opacity'];

        $color = str_replace('#', '', $color);

        if (\strlen($color) === 3) {
            $opacity = dechex($opacity * 15);

            return $opacity.$color;
        }

        if (\strlen($color) === 6) {
            $opacity = dechex($opacity * 255);
            $val = $opacity.$color;
            if (\strlen($val) === 7) {
                $val = '0'.$val;
            }

            return $val;
        }

        if (\strlen($color) === 4 || \strlen($color) === 8) { // assume color already is 4 or 8 digit rgba. 
            return $color;
        }

        return '0fff';
    }