rouge-ruby/rouge · error · ArgumentError

invalid theme: #{theme.inspect}

Error message

invalid theme: #{theme.inspect}

What it means

Error "invalid theme: #{theme.inspect}" thrown in rouge-ruby/rouge.

Source

Thrown at lib/rouge/formatters/terminal256.rb:24

    # A formatter for 256-color terminals
    class Terminal256 < Formatter
      tag 'terminal256'

      # max distance between two colors, #000000 to #ffffff
      MAX_DISTANCE = 257 * 257 * 3

      # @private
      attr_reader :theme

      # @param [Hash,Rouge::Theme] theme
      #   the theme to render with.
      def initialize(theme = Themes::ThankfulEyes.new)
        if theme.is_a?(Rouge::Theme)
          @theme = theme
        elsif theme.is_a?(Hash)
          @theme = theme[:theme] || Themes::ThankfulEyes.new
        else
          raise ArgumentError, "invalid theme: #{theme.inspect}"
        end
      end

      def stream(tokens, &b)
        tokens.each do |tok, val|
          escape_sequence(tok).stream_value(val, &b)
        end
      end

      class EscapeSequence
        attr_reader :style
        def initialize(style)
          @style = style
        end

        def self.xterm_colors
          @xterm_colors ||= [].tap do |out|
            # colors 0..15: 16 basic colors

View on GitHub (pinned to bd7dad7b09)

When it happens

Trigger: Thrown at lib/rouge/formatters/terminal256.rb:24 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rouge-ruby/rouge@bd7dad7b09 (2026-08-23). Data as JSON: /api/errors/a08ed700ef7dc9e4. Report an issue: GitHub.