class Rouge::Theme

def self.palette(arg={})

def self.palette(arg={})
  @palette ||= InheritableHash.new(superclass.palette)
  if arg.is_a? Hash
    @palette.merge! arg
    @palette
  else
    case arg
    when /#[0-9a-f]+/i
      arg
    else
      @palette[arg] or raise "not in palette: #{arg.inspect}"
    end
  end
end

def self.render(opts={}, &b)

def self.render(opts={}, &b)
  new(opts).render(&b)
end

def self.styles

def self.styles
  @styles ||= InheritableHash.new(superclass.styles)
end

def find(n)

def find(n)
  registry[n.to_s]
end

def get_own_style(token)

def get_own_style(token)
  token.ancestors do |anc|
    return styles[anc.name] if styles[anc.name]
  end
end

def get_style(token)

def get_style(token)
  get_own_style(token) || style['Text']
end

def name(n=nil)

def name(n=nil)
  return @name if n.nil?
  @name = n.to_s
  Theme.registry[@name] = self
end

def registry

def registry
  @registry ||= {}
end

def style(*tokens)

def style(*tokens)
  style = tokens.last.is_a?(Hash) ? tokens.pop : {}
  style = Style.new(self, style)
  tokens.each do |tok|
    styles[tok.to_s] = style
  end
end

def styles

def styles
  @styles ||= self.class.styles.dup
end