public static function fromString(string $string, array $properties = null) : ?Style
    {
        if (!preg_match_all('/([^:]+):([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
            return null;
        }

        // H-okay, seems we got a match.
        $style = new Style(null);

        foreach ($matches as $match) {

            // Be forgiving regarding whitespaces (or lack thereof) in the string.
            $property = trim($match[1]);
            $value    = trim($match[2]);

            if ($property === ($properties['foreground'] ?? 'color')) {
                $style->setForeground($value);
            } elseif ($property === ($properties['background'] ?? 'bg')) {
                $style->setBackground($value);
            } else {
                $style->setEmphasis([$value]);
            }
        }

        return $style;
    }