Dynamically changing the font in the console

Is there a suitable plugin or class for changing font size, font type, and styling within a common output console?

You can change the terminal font by going to settings, but that's not what I'm looking for here. I want to dynamically change the font from within.

Is there anything in Ruby or some terminal commands for this (I'm using Mac OS X).

+3


source to share


3 answers


The font / font size used in ANSI terminals is implementation specific and ANSI color / style codes are the only way to provide decoration. The easiest way I've found to add color and style for console output is by using 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 colorized README .

Or, if you want to love yourself and do some UI elements, you can use rbcurse

gem:

gem install rbcurse

Here are some screenshots of rbcurse .

+2


source


I suggest you use fancy_irb modules which can beautify your irb console. :)



gem install fancy_irb

0


source


It is not possible to dynamically change the font size or font size in standard terminals. Basically they only recognize standard VT ANSI / escape codes which only support colors and (some) style.

0


source







All Articles