Module: Autumn::Formatting::Ircle
- Defined in:
- lib/autumn/formatting.rb
Overview
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.
Constant Summary collapse
- PLAIN =
Insert this character to set all following text unformatted and uncolored.
15.chr
- BOLD =
Insert this character to set all following text bolded.
2.chr
- ITALIC =
Insert this character to set all following text italicized.
22.chr
- UNDERLINE =
Insert this character to set all following text underlined.
31.chr
- COLOR_CODE =
The ircle color code sentinel.
3.chr
- COLORS =
Insert a character from this hash to set the color of all following text.
{ :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' }
- UNCOLOR =
For purposes of cross-compatibility, this constant has been added to match the Mirc module. Removes all formatting and coloring on all following text.
PLAIN
Instance Method Summary collapse
-
#bold ⇒ Object
Sets all following text bold.
-
#color(fgcolor, bgcolor = nil, options = {}) ⇒ Object
For purposes of cross-compatibility, this method has been added to match the Mirc method with the same name.
-
#italic ⇒ Object
Sets all following text italic.
-
#plain ⇒ Object
Sets all following text unformatted.
-
#underline ⇒ Object
Sets all following text underline.
Instance Method Details
#bold ⇒ Object
Sets all following text bold.
227 |
# File 'lib/autumn/formatting.rb', line 227 def bold; BOLD; end |
#color(fgcolor, bgcolor = nil, options = {}) ⇒ Object
For purposes of cross-compatibility, this method has been added to match the Mirc method with the same name. All inapplicable parameters and color names are ignored.
219 220 221 |
# File 'lib/autumn/formatting.rb', line 219 def color(fgcolor, bgcolor=nil, ={}) COLORS[fgcolor] end |
#italic ⇒ Object
Sets all following text italic.
230 |
# File 'lib/autumn/formatting.rb', line 230 def italic; ITALIC; end |
#plain ⇒ Object
Sets all following text unformatted.
224 |
# File 'lib/autumn/formatting.rb', line 224 def plain; PLAIN; end |
#underline ⇒ Object
Sets all following text underline.
233 |
# File 'lib/autumn/formatting.rb', line 233 def underline; UNDERLINE; end |