private function color($text, $fg, $bg = null)
    {
        if ($this->getConfig('use-colors')) {
            
            $colors = [];
            
            if ($fg != 'none') {
                $colors[] = sprintf('fg=%s', $fg);
            }
            
            if ($bg && $bg != 'none') {
                $colors[] = sprintf('bg=%s', $bg);
            }
            
            if (!empty($colors)) {
                return sprintf('<%s>%s</>', implode(';', $colors), $text);
            }
        }
        
        return $text;
    }