lib/rouge/formatters/terminal256.rb in rouge-0.2.0 vs lib/rouge/formatters/terminal256.rb in rouge-0.2.1
- old
+ new
@@ -1,13 +1,19 @@
module Rouge
module Formatters
+ # A formatter for 256-color terminals
class Terminal256 < Formatter
tag 'terminal256'
+ # @private
attr_reader :theme
+
+
+ # @option opts :theme
+ # (default is thankful_eyes) the theme to render with.
def initialize(opts={})
- @theme = opts[:theme] || Themes::ThankfulEyes
+ @theme = opts[:theme] || 'thankful_eyes'
@theme = Theme.find(@theme) if @theme.is_a? String
end
def stream(tokens, &b)
tokens.each do |tok, val|
@@ -93,10 +99,10 @@
escape(attrs)
end
end
- # private
+ private
def escape(attrs)
return '' if attrs.empty?
"\e[#{attrs.join(';')}m"
end