public
Created

ROFLBALT Pixel

  • Download Gist
pixel.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
class Pixel
def initialize char = " ", fg = nil, bg = nil
@char = char
@fg, @bg = fg, bg
end
attr_reader :char
def fg; @fg || 255 end
def bg; @bg || 0 end
def to_s
"\033[48;5;%dm\033[38;5;%dm%s" % [ bg, fg, @char ]
end
def color_equal? other
fg == other.fg && bg == other.bg
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.