Permalink
Browse files

.color

  • Loading branch information...
1 parent e2062ab commit e6bed71d38df170975416172d1f9cdd799faf91f @natano natano committed Oct 2, 2008
Showing with 4 additions and 4 deletions.
  1. +2 −2 console.rb
  2. +2 −2 main.rb
View
@@ -65,7 +65,7 @@ def self.color=(arg) # colorize a string
if arg.length > 2
arg[2] = bg_color[arg[2]] # background color
end
- print "\e[" + arg.join(";") + "m" # magic ansi
+ print "\e[#{arg[0]};#{arg[1]}m" # magic ansi
# escape sequence
end
@@ -125,6 +125,6 @@ def self.position=(*arg)
if arg.length > 1
col = arg[1]
end
- Kernel.print "\e[" + row.to_s + ";" + col.to_s + "H"
+ print "\e[" + row.to_s + ";" + col.to_s + "H"
end
end
View
@@ -5,15 +5,15 @@
Console.clear
-print "hello\n".color :normal, :red, :bg_white
+"hello\n".color :normal, :red, :bg_white
print Cursor.position.join(", ")
Cursor.position = nil
print "links oben"
Cursor.position = 5
-print "5te zeile".color :blink, :red
+"5te zeile".color :blink, :red
#Cursor.position = (6, "5te zeile".length)
Cursor.position = 6,4

0 comments on commit e6bed71

Please sign in to comment.