private static function getAnsiCon()
    {
        if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
            // extract [w, H] from "wxh (WxH)"
            // or [w, h] from "wxh"
            return [
                (int) $matches[1],
                isset($matches[4]) ? (int) $matches[4] : (int) $matches[2],
            ];
        }

        return [];
    }