# File lib/paint/util.rb, line 36
    def detect_mode
      if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # windows
        if ENV['ANSICON']
          16
        elsif ENV['ConEmuANSI'] == 'ON'
          256
        else
          0
        end
      else
        # case ENV['COLORTERM']
        # when 'gnome-terminal'
        #   256
        # else
          case ENV['TERM']
          when /-256color$/, 'xterm'
            256
          when /-color$/, 'rxvt'
            16
          else # optimistic default
            256
          end
        # end
      end
    end