ruby - Ruby 中的终端颜色

标签 ruby bash shell colors terminal

是否有用于在 Linux 终端中为字符串着色的 Ruby 模块?

最佳答案

我更喜欢 Rainbow gem因为如果安装了 win32console gem,它也支持 Windows。

你可以这样使用它:

puts "some " + "red".color(:red) + " and " + "blue on yellow".color(:blue).background(:yellow)

关于ruby - Ruby 中的终端颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1108767/

相关文章:

ruby - 如何在 ruby​​ 中合并两个具有相同键的散列

ruby - 如何从ansible脚本调用capistrano

ruby - 如何测试基于 Curl 的 FaceBook API 实现?

macos - 如何将剪贴板上的文本行作为 bash 命令执行

linux - 如何制作连接到 VM 并执行命令的 shell 脚本?

html - 内联 PDF 查看器

linux - ACL 如何影响 ls/stat() 结果?

linux - 从 bash 脚本生成 bash 脚本

php - 如何通过shell在php中获取在后台exec中运行的进程的pid

c++ - Eye of Gnome - 使用 shell 脚本在不同窗口打开两个图像