彩色Ruby输出到终端 [英] Colorized Ruby output to the terminal
本文介绍了彩色Ruby输出到终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Ruby,如何在终端中对输出的背景和前景文本进行着色?
Using Ruby, how can I perform background and foreground text colorization for output in the terminal?
我记得,在对Pascal进行编程时,我们都曾经编写过自己的 textcolor(…)
程序使我们的小型教育程序看起来更美观,更具呈现性。
I remember, when programming Pascal we all used to write our own textcolor(…)
procedures to make our small educational programs look more pretty and presentational.
我将如何编码
推荐答案
Colorize是我最喜欢的宝石! :-)
Colorize is my favorite gem! :-)
签出:
https://github.com/fazibear/colorize
安装:
gem install colorize
用法:
require 'colorize'
puts "I am now red".red
puts "I am now blue".blue
puts "Testing".yellow
这篇关于彩色Ruby输出到终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文