Module | Autumn::Formatting::Ircle |
In: |
lib/autumn/formatting.rb
|
The ircle formatting system is an adaptation of the mIRC system, written for use by the ircle Macintosh client. Its primary purpose is to improve upon mIRC‘s lackluster color support. The ircle protocol is identical to the mIRC protocol for purposes of text styling (bold, italic, underline), so stylized text will appear the same on both clients.
The only difference is in text colorization, for which ircle has a slightly better system, but one that is incompatible with mIRC-type clients.
Styling text is done exactly as it is in the Mirc module; coloring text is done with the COLORS hash, as so:
"The system is: #{COLORS[:red]}down#{PLAIN}!"
Note that there is no support for background coloring.
PLAIN | = | 15.chr | Insert this character to set all following text unformatted and uncolored. | |
BOLD | = | 2.chr | Insert this character to set all following text bolded. | |
ITALIC | = | 22.chr | Insert this character to set all following text italicized. | |
UNDERLINE | = | 31.chr | Insert this character to set all following text underlined. | |
COLOR_CODE | = | 3.chr | The ircle color code sentinel. | |
COLORS | = | { :white => COLOR_CODE + '0', :black => COLOR_CODE + '1', :red => COLOR_CODE + '2', :orange => COLOR_CODE + '3', :yellow => COLOR_CODE + '4', :light_green => COLOR_CODE + '5', :green => COLOR_CODE + '6', :blue_green => COLOR_CODE + '7', :cyan => COLOR_CODE + '8', :light_blue => COLOR_CODE + '9', :blue => COLOR_CODE + ':', :purple => COLOR_CODE + ';', :magenta => COLOR_CODE + '<', :purple_red => COLOR_CODE + '=', :light_gray => COLOR_CODE + '>', :dark_gray => COLOR_CODE + '?', :dark_red => COLOR_CODE + '@', :dark_orange => COLOR_CODE + 'A', :dark_yellow => COLOR_CODE + 'B', :dark_light_green => COLOR_CODE + 'C', :dark_green => COLOR_CODE + 'D', :dark_blue_green => COLOR_CODE + 'E', :dark_cyan => COLOR_CODE + 'F', :dark_light_blue => COLOR_CODE + 'G', :dark_blue => COLOR_CODE + 'H', :dark_purple => COLOR_CODE + 'I', :dark_magenta => COLOR_CODE + 'J', :dark_purple_red => COLOR_CODE + 'K', # User-defined colors: :server_message => COLOR_CODE + 'a', :standard_message => COLOR_CODE + 'b', :private_message => COLOR_CODE + 'c', :notify => COLOR_CODE + 'd', :dcc_ctcp => COLOR_CODE + 'e', :window_bg => COLOR_CODE + 'f', :own_message => COLOR_CODE + 'g', :notice => COLOR_CODE + 'h', :user_highlight => COLOR_CODE + 'i', :userlist_chanop => COLOR_CODE + 'l', :userlist_ircop => COLOR_CODE + 'm', :userlist_voice => COLOR_CODE + 'n' | Insert a character from this hash to set the color of all following text. | |
UNCOLOR | = | PLAIN | For purposes of cross-compatibility, this constant has been added to match the Mirc module. Removes all formatting and coloring on all following text. |