Reputation: 6862
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).
Upvotes: 4
Views: 4182
Reputation: 1639
If you are looking for a solution for the rails default webconsole (displayed inside a browser) I suggest to get a browserextension where you can add additional styling to a page and then just override the following classes:
.console-prompt-label,
.console-prompt-display,
.console-message {
font-size: 16px;
line-height: 16px;
}
If you're using chrome you can use StyleBot. Then you would need to:
rails server
and open localhost inside your browserOpen Stylebot...
Edit CSS
that's it, no more small console ouput ever.
Upvotes: 0
Reputation: 388
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.
Upvotes: 3
Reputation: 13877
There is no way to dynamically change the font face or font size in standard terminals. They mostly only recognise the standard ANSI/VT escape codes, which only support colors and (some) style.
Upvotes: 1
Reputation: 26998
I suggest you can use fancy_irb modules, which can decorate your irb console. :)
gem install fancy_irb
Upvotes: 0