Project

concolor

0.0
Low commit activity in last 3 years
No release in over a year
Colorize console text
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Concolor

Gem Ruby CI RubyDoc

With Concolor you can change the fore- and background colors and text decorations when rendering text on terminals supporting ANSI escape codes. It adds the concolor method to String objects.

License Stars Forks Watchers

Used technologies, API, tools, etc

ruby-logo git-logo github-actions-logo rubocop-logo vs-code-logo docker-logo ruby-gems-logo

Development

Gem development information and current project status:

Ruby CI Open issues Closed issues

Installation

Just install the concolor gem

gem install concolor

or if you use bundler put this in your Gemfile

gem 'concolor'

Usage

require 'concolor'

puts 'Some text'.concolor(:bold, :red)
# "\033[31;1mSome text\033[0m"

Foreground color & Background color

Foreground color code color Background color code
:default 29 :bg_default 49
:black 30 #000000 :bg_black 40
:red 31 #CD0000 :bg_red 41
:green 32 #00CD00 :bg_green 42
:yellow 33 #CDCD00 :bg_yellow 43
:blue 34 #1E90FF :bg_blue 44
:magenta 35 #CD00CD :bg_magenta 45
:cyan 36 #00CDCD :bg_cyan 46
:light_gray 37 #E5E5E5 :bg_light_gray 47
:dark_gray 90 #4C4C4C :bg_dark_gray 100
:light_red 91 #FF0000 :bg_light_red 101
:light_green 92 #00FF00 :bg_light_green 102
:light_yellow 93 #FFFF00 :bg_light_yellow 103
:light_blue 94 #4682B4 :bg_light_blue 104
:light_magenta 95 #FF00FF :bg_light_magenta 105
:light_cyan 96 #00FFFF :bg_light_cyan 106
:white 97 #FFFFFF :bg_white 107

Mode (modifying the style of text)

Symbol Description code
:reset Reset all SGR effects to their default 0
:bold Bold or increased intensity 1
:faint Faint or decreased intensity 2
:italic Italic 3
:underline Singly underlined 4
:blink Blink (slow) 5
:blink_fast Blink (fast) 6
:reverse Reverse (invert the foreground and background colors) 7
:hide Hidden (useful for passwords) 8
:cross Cross-out 9