Top Level Namespace
Defined Under Namespace
Modules: BasicLogging
Classes: Body, Configuration, Headers, Newsgroups, OverrideDlg, PostProcessor, String
Constant Summary
collapse
- WRAP_LENGTH =
65
- PROGNAME =
/***************************************************************************
* 2023-2024, Michael Uplawski <[email protected]> *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the WTFPL 2.0 or later, see *
* http://www.wtfpl.net/about/ *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
***************************************************************************/
'flnews_post_proc'
- PROGVERSION =
"1.70"
- AUTHORS =
"Michael Uplawski"
- EMAIL =
"[email protected]"
- YEARS =
"2023 - 2024"
- SUMMARY =
"Read random signature from file"
- COLORS =
Functions to apply colors to terminal output. This is stolen from the Internet and I have lost track of my own additions and modifications.
{:default => 9, :black => 0, :red => 1, :green => 2, :yellow => 3, :blue => 4, :purple => 5, :cyan => 6, :white => 7 }
- BG =
4
- FG =
3
- REGULAR =
0
- BOLD =
1
- UNDERLINE =
4
- BLINK =
5
- SWAP =
7
- NEUTRAL =
0
- STYLES =
{:regular => REGULAR, :bold => BOLD, :underline => UNDERLINE, :blink => BLINK, :swap => SWAP, :neutral => NEUTRAL}
Instance Method Summary
collapse
Instance Method Details
#black_on_white(text) ⇒ Object
60
|
# File 'lib/color_output.rb', line 60
def black_on_white(text); colorize(colorize(text, "\033[30m"), "\033[47m");end
|
#blue(text) ⇒ Object
57
|
# File 'lib/color_output.rb', line 57
def blue(text); colorize(text, "\033[34m"); end
|
#bold(text) ⇒ Object
63
|
# File 'lib/color_output.rb', line 63
def bold(text); style(text, "\033[01m");end
|
#colored_output(output_text, fg_color = :default, bg_color = :default, style = :regular, mode = :neutral) ⇒ Object
a function which allows to manipulate every known aspect of the ansi-output.
47
48
49
|
# File 'lib/color_output.rb', line 47
def colored_output(output_text, fg_color = :default, bg_color = :default, style = :regular , mode = :neutral )
"\033[%i;%i;%i%i;%i%im%s\033[0m" %[STYLES[mode.to_sym], STYLES[style.to_sym], FG, COLORS[fg_color.to_sym], BG, COLORS[bg_color.to_sym], output_text]
end
|
#colorize(text, color_code) ⇒ Object
Colorizes the given text. Color-code is either an escape-sequence or one of the symbols representing color-names in the COLORS hash.
35
36
37
38
39
40
41
|
# File 'lib/color_output.rb', line 35
def colorize(text, color_code)
if (COLORS.keys.include?(color_code) )
"\033[3#{COLORS[color_code]}m#{text}\033[0m"
else
"#{color_code}#{text}\033[0m"
end
end
|
#cyan(text) ⇒ Object
56
|
# File 'lib/color_output.rb', line 56
def cyan(text); colorize(text, "\033[36m"); end
|
#green(text) ⇒ Object
53
|
# File 'lib/color_output.rb', line 53
def green(text); colorize(text, "\033[32m"); end
|
#purple(text) ⇒ Object
55
|
# File 'lib/color_output.rb', line 55
def purple(text); colorize(text, "\033[35m"); end
|
#red(text) ⇒ Object
52
|
# File 'lib/color_output.rb', line 52
def red(text); colorize(text, "\033[31m"); end
|
#style(text, style_code) ⇒ Object
43
44
45
|
# File 'lib/color_output.rb', line 43
def style(text, style_code)
"#{style_code}#{text}\033[0m"
end
|
#underline(text) ⇒ Object
64
|
# File 'lib/color_output.rb', line 64
def underline(text); style(text, "\033[04m");end
|
#white(text) ⇒ Object
58
|
# File 'lib/color_output.rb', line 58
def white(text); colorize(text, "\033[37m"); end
|
#white_on_black(text) ⇒ Object
61
|
# File 'lib/color_output.rb', line 61
def white_on_black(text); colorize(colorize(text, "\033[37m"), "\033[40m");end
|
#yellow(text) ⇒ Object
54
|
# File 'lib/color_output.rb', line 54
def yellow(text); colorize(text, "\033[33m"); end
|