Overview
ANSI escape codes can be used to output bold text in the console. Please note that
- In MAC/Linux system terminal supports ANSI escape codes
- Windows Command Prompt doesn’t support it. On windows, you can install Cygwin. ANSI escape codes work on that.
Program
class String
def bold
"\e[1m#{self}\e[22m"
end
end
puts "Bold String".bold
Output