Change Font dynamically in console
console, fonts, irb, ruby, terminal
Solution
The font/font size used in ANSI terminals are implementation specific, and ANSI color/style codes are the only way to provide decoration. Simplest way I've found to add color and style to console output is use the `colorize` gem.
`gem install colorize`
Examples:
puts "This is blue".colorize( :blue )
puts "This is light blue".colorize( :light_blue )
puts "This is also blue".colorize( :color => :blue )
puts "This is red on blue and underline".colorize( :red ).on_blue.underline
puts "This is blue text on red".blue.on_red.blink
Here is the colorize README.
Or if you'd like to get fancier and do some UI elements, you can use the `rbcurse` gem:
`gem install rbcurse`
Here are some rbcurse screenshots.
Problem
Is there a proper plugin or a class to change font size, font type and decoration within a common output console? You can change terminal's font by going into preferences but that is not what I'm looking for here. I want to be able to change font dynamically from within code. Is there anything in Ruby or some terminal commands to do so (I use Mac OS X).