彩色Ruby输出 [英] Colorized Ruby output

查看:156
本文介绍了彩色Ruby输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有适当的插件或类在常见的输出控制台中执行背景和前景文本着色?

Is there a proper plugin or a class to perform background and foreground text colorization within a common output console?

我记得,在编程Pascal时,使用 textcolor(...)程序,使我们的小型教育计划看起来更漂亮,更具表现力。

I remember, when programming Pascal we all used to play with textcolor(...) procedures to make our small educational programs look more pretty and presentational.

什么类似的Ruby?

推荐答案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆