class Rouge::Formatters::TerminalTruecolor::TruecolorEscapeSequence

def get_rgb(color)

def get_rgb(color)
  color = $1 if color =~ /#(\h+)/
  case color.size
  when 3 then color.chars.map { |c| c.to_i(16) * 2 }
  when 6 then color.scan(/../).map { |cc| cc.to_i(16) }
  else
    raise "invalid color: #{color.inspect}"
  end
end

def style_string

def style_string
  @style_string ||= begin
    out = String.new('')
    out << escape(['48', '2', *get_rgb(style.bg)]) if style.bg
    out << escape(['38', '2', *get_rgb(style.fg)]) if style.fg
    out << escape(['1']) if style[:bold] || style[:italic]
    out
  end
end