diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ruby2d.rb | 3 | ||||
| -rw-r--r-- | lib/ruby2d/colorize.rb | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/ruby2d.rb b/lib/ruby2d.rb index 58a69da..2471888 100644 --- a/lib/ruby2d.rb +++ b/lib/ruby2d.rb @@ -1,7 +1,8 @@ # Ruby2D module and native extension loader, adds DSL -require 'ruby2d/renderable' +require 'ruby2d/colorize' require 'ruby2d/exceptions' +require 'ruby2d/renderable' require 'ruby2d/color' require 'ruby2d/window' require 'ruby2d/dsl' diff --git a/lib/ruby2d/colorize.rb b/lib/ruby2d/colorize.rb new file mode 100644 index 0000000..856ecb8 --- /dev/null +++ b/lib/ruby2d/colorize.rb @@ -0,0 +1,10 @@ +# String#colorize + +# Extend `String` to include some fancy colors +class String + def colorize(c); "\e[#{c}m#{self}\e[0m" end + def bold; colorize('1') end + def info; colorize('1;34') end + def warn; colorize('1;33') end + def error; colorize('1;31') end +end |
