-
Notifications
You must be signed in to change notification settings - Fork 2
Extends String class to use ANSI color escape codes.
License
mruby-Forum/mruby-ansi-colors
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# mruby-ansi-colors Extends String class to use ANSI color escape codes. # Returns an Hash with every color code pair. "".color_codes => {:black=>30, :light_black=>90, :bg_black=>40, :bg_light_black=>100, :red=>31, :light_red=>91, :bg_red=>41, :bg_light_red=>101, :green=>32, :light_green=>92, :bg_green=>42, :bg_light_green=>102, :yellow=>33, :light_yellow=>93, :bg_yellow=>43, :bg_light_yellow=>103, :blue=>34, :light_blue=>94, :bg_blue=>44, :bg_light_blue=>104, :magenta=>35, :light_magenta=>95, :bg_magenta=>45, :bg_light_magenta=>105, :cyan=>36, :light_cyan=>96, :bg_cyan=>46, :bg_light_cyan=>106, :white=>37, :light_white=>97, :bg_white=>47, :bg_light_white=>107, :default=>39, :bg_default=>49} # Returns and Array of Symbols representing every color. "".colors => [:black, :light_black, :bg_black, :bg_light_black, :red, :light_red, :bg_red, :bg_light_red, :green, :light_green, :bg_green, :bg_light_green, :yellow, :light_yellow, :bg_yellow, :bg_light_yellow, :blue, :light_blue, :bg_blue, :bg_light_blue, :magenta, :light_magenta, :bg_magenta, :bg_light_magenta, :cyan, :light_cyan, :bg_cyan, :bg_light_cyan, :white, :light_white, :bg_white, :bg_light_white, :default, :bg_default] # Returns a Hash of mode codes(different state the text can be displayed in). "".mode_codes => {:default=>0, :bold=>1, :italic=>3, :underline=>4, :blink=>5, :swap=>7, :hide=>8} default: 0, # Turn off all attributes bold: 1, # Set bold mode italic: 3, # Set italic mode underline: 4, # Set underline mode blink: 5, # Set blink mode swap: 7, # Exchange foreground and background colors hide: 8 # Hide text (foreground color would be the same as background) # Returns and Array of modes. "".modes => [:default, :bold, :italic, :underline, :blink, :swap, :hide] # Sets the strings color, and mode. String.set_color(fg_color, bg_color = :bg_default, mode = :default) "".set_color(:red, :bg_blue, :bold) alias color # Example Using this library is as easy as this: "My dog is red!".red
About
Extends String class to use ANSI color escape codes.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published