blob: 520ff3cabc63594f81ca7ed85a19031baa202926 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
Small Ruby library that colors strings using ANSI escape sequences.
It's possible to use constants:
print red, bold, "red bold", reset, "\n"
or unary functions:
print red(bold("red bold")), "\n"
Blockforms do also autoreset at the block's end:
print red { bold { "red bold" } }, "\n"
It's also possible to use this module as Mixin for classes of objects that
respond to :to_str, e.g. String.
class String
include Term::ANSIColor
end
print "red bold".red.bold, "\n"
|