colours 0.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENCE.md +22 -0
- data/README.md +1152 -0
- data/bin/colours +7 -0
- data/bin/egreen +7 -0
- data/bin/fancy_parse +7 -0
- data/bin/html_colour_to_hex_value +7 -0
- data/bin/html_colourize +7 -0
- data/bin/orange +7 -0
- data/bin/print_rainbow_line +7 -0
- data/bin/rainbow_colours +7 -0
- data/bin/remove_ansii_escape_sequences +7 -0
- data/bin/steelblue +7 -0
- data/colours.gemspec +74 -0
- data/doc/COLOUR_CODES_CHART.md +27 -0
- data/doc/HOW_TO_PICK_YOUR_OWN_COLOURS.md +28 -0
- data/doc/README.gen +1105 -0
- data/doc/todo/todo.md +25 -0
- data/lib/colours/256_colours/support_for_256_colours.rb +196 -0
- data/lib/colours/autoalias_e.rb +10 -0
- data/lib/colours/autogenerated/README.md +2 -0
- data/lib/colours/autogenerated/support_for_256_colours.rb +2235 -0
- data/lib/colours/autogenerated/support_for_html_colours.rb +1778 -0
- data/lib/colours/autogenerated/toplevel_basic_colour_methods.rb +7001 -0
- data/lib/colours/autoinclude.rb +14 -0
- data/lib/colours/base/base.rb +29 -0
- data/lib/colours/basic_colours/README.md +4 -0
- data/lib/colours/basic_colours/basic_colours.rb +334 -0
- data/lib/colours/class/colours.rb +537 -0
- data/lib/colours/colour_methods/README.md +11 -0
- data/lib/colours/colour_methods/colour_methods.rb +685 -0
- data/lib/colours/colour_table/README.md +2 -0
- data/lib/colours/colour_table/colour_table.rb +282 -0
- data/lib/colours/colours_e_autoinclude.rb +9 -0
- data/lib/colours/commandline/README.md +2 -0
- data/lib/colours/commandline/commandline.rb +58 -0
- data/lib/colours/commandline/menu.rb +122 -0
- data/lib/colours/constants/constants.rb +9 -0
- data/lib/colours/constants/escape.rb +22 -0
- data/lib/colours/constants/file_constants.rb +73 -0
- data/lib/colours/constants/hash_ansi_colours.rb +39 -0
- data/lib/colours/constants/hash_simple_colours.rb +148 -0
- data/lib/colours/constants/misc.rb +361 -0
- data/lib/colours/constants/newline.rb +14 -0
- data/lib/colours/constants/registered_colour_methods.rb +53 -0
- data/lib/colours/e/README.md +13 -0
- data/lib/colours/e/autoinclude.rb +11 -0
- data/lib/colours/e/e.rb +35 -0
- data/lib/colours/e.rb +5 -0
- data/lib/colours/eparse/eparse.rb +114 -0
- data/lib/colours/everything/autoinclude.rb +11 -0
- data/lib/colours/html_colours/README.md +1 -0
- data/lib/colours/html_colours/add_html_colours_onto_the_toplevel_namespace.rb +22 -0
- data/lib/colours/html_colours/html_colours.rb +424 -0
- data/lib/colours/kde_colour_palette/kde_colour_palette.rb +132 -0
- data/lib/colours/map_symbol_to_corresponding_colour/map_symbol_to_corresponding_colour.rb +224 -0
- data/lib/colours/module.rb +11 -0
- data/lib/colours/project/project.rb +22 -0
- data/lib/colours/rainbow_colours/README.md +2 -0
- data/lib/colours/rainbow_colours/check_for_trollop_being_available_or_exit.rb +26 -0
- data/lib/colours/rainbow_colours/constants.rb +30 -0
- data/lib/colours/rainbow_colours/do_parse_via_rainbow_colours.rb +164 -0
- data/lib/colours/rainbow_colours/paint_detected_mode.rb +20 -0
- data/lib/colours/rainbow_colours/print_rainbow_line.rb +68 -0
- data/lib/colours/rainbow_colours/println_ani.rb +32 -0
- data/lib/colours/rainbow_colours/println_plain.rb +36 -0
- data/lib/colours/rainbow_colours/rainbow.rb +38 -0
- data/lib/colours/rainbow_colours/report_errors.rb +32 -0
- data/lib/colours/rainbow_colours/returnln_plain.rb +63 -0
- data/lib/colours/rainbow_colours/set_mode.rb +24 -0
- data/lib/colours/requires/require_autogenerated_colour_methods.rb +5 -0
- data/lib/colours/requires/require_commandline.rb +7 -0
- data/lib/colours/requires/require_eparse.rb +11 -0
- data/lib/colours/requires/require_rgb.rb +5 -0
- data/lib/colours/requires/require_the_256_colours_module.rb +16 -0
- data/lib/colours/requires/require_the_basic_colours.rb +7 -0
- data/lib/colours/requires/require_the_colour_methods.rb +34 -0
- data/lib/colours/requires/require_the_colour_table.rb +7 -0
- data/lib/colours/requires/require_the_constants.rb +5 -0
- data/lib/colours/requires/require_the_html_colours.rb +11 -0
- data/lib/colours/requires/require_the_kde_colour_palette.rb +7 -0
- data/lib/colours/requires/require_the_project.rb +53 -0
- data/lib/colours/requires/require_the_toplevel_methods.rb +42 -0
- data/lib/colours/requires/require_yaml.rb +9 -0
- data/lib/colours/rgb/rgb.rb +550 -0
- data/lib/colours/testing/README.md +2 -0
- data/lib/colours/testing/testing.rb +168 -0
- data/lib/colours/toplevel_methods/autogenerate.rb +310 -0
- data/lib/colours/toplevel_methods/bold.rb +41 -0
- data/lib/colours/toplevel_methods/bold_and_italic.rb +38 -0
- data/lib/colours/toplevel_methods/cat.rb +39 -0
- data/lib/colours/toplevel_methods/clear_screen.rb +18 -0
- data/lib/colours/toplevel_methods/cliner.rb +17 -0
- data/lib/colours/toplevel_methods/col.rb +54 -0
- data/lib/colours/toplevel_methods/e.rb +69 -0
- data/lib/colours/toplevel_methods/esystem.rb +19 -0
- data/lib/colours/toplevel_methods/html_colour_to_hex_value.rb +41 -0
- data/lib/colours/toplevel_methods/html_colourize.rb +69 -0
- data/lib/colours/toplevel_methods/is_on_roebe.rb +16 -0
- data/lib/colours/toplevel_methods/italic.rb +110 -0
- data/lib/colours/toplevel_methods/make_colour.rb +28 -0
- data/lib/colours/toplevel_methods/methods_related_to_html_colours.rb +336 -0
- data/lib/colours/toplevel_methods/misc.rb +226 -0
- data/lib/colours/toplevel_methods/open_this_file.rb +26 -0
- data/lib/colours/toplevel_methods/prefer_this_colour_schemata.rb +88 -0
- data/lib/colours/toplevel_methods/random_value.rb +37 -0
- data/lib/colours/toplevel_methods/remove_escape_sequence.rb +112 -0
- data/lib/colours/toplevel_methods/revert.rb +104 -0
- data/lib/colours/toplevel_methods/set_last_colour_used.rb +32 -0
- data/lib/colours/toplevel_methods/shell_file_containing_the_html_colours.sh +148 -0
- data/lib/colours/toplevel_methods/show_basic_colour_palette.rb +36 -0
- data/lib/colours/toplevel_methods/underline.rb +130 -0
- data/lib/colours/toplevel_methods/use_colours.rb +290 -0
- data/lib/colours/version/version.rb +25 -0
- data/lib/colours/yaml/256_colours.yml +279 -0
- data/lib/colours/yaml/basic_colours.yml +25 -0
- data/lib/colours/yaml/html_colours.yml +837 -0
- data/lib/colours/yaml/kde_colour_palette.yml +183 -0
- data/lib/colours/yaml/prefer_this_colour_schemata.yml +17 -0
- data/lib/colours/yaml/use_these_values_for_the_colour_methods.yml +15 -0
- data/lib/colours.rb +1 -0
- data/test/test.html +18 -0
- data/test/testing_256_colours_support.rb +29 -0
- data/test/testing_bold_italic_underline.rb +26 -0
- data/test/testing_class_colours.rb +46 -0
- data/test/testing_col.rb +10 -0
- data/test/testing_colours.rb +96 -0
- data/test/testing_colours_e.rb +13 -0
- data/test/testing_eparse.rb +13 -0
- data/test/testing_italic.rb +28 -0
- data/test/testing_kde_colour_palette.rb +30 -0
- data/test/testing_konsole_submodule.rb +226 -0
- data/test/testing_map_symbol_to_corresponding_colour.rb +14 -0
- data/test/testing_replace_number_words_with_the_corresponding_html_colour.rb +39 -0
- data/test/testing_rgb_to_hex.rb +32 -0
- data/test/testing_the_basic_colours_of_the_colours_project.rb +62 -0
- data/test/testing_the_colour_methods.rb +36 -0
- data/test/testing_the_constants_of_the_colours_project.rb +9 -0
- data/test/testing_the_ecomment_method.rb +11 -0
- data/test/testing_the_html_colours_of_the_colours_project.rb +37 -0
- data/test/testing_the_regex_for_capturing_the_commandline_coloured_content.rb +112 -0
- data/test/testing_whether_colours_will_be_used.rb +7 -0
- metadata +225 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# =========================================================================== #
|
|
2
|
+
# === The KDE colour palette
|
|
3
|
+
#
|
|
4
|
+
# This file specifically stores colours defined and used by the "KDE
|
|
5
|
+
# colour palette". This can be found here:
|
|
6
|
+
#
|
|
7
|
+
# https://community.kde.org/KDE_Visual_Design_Group/HIG/Color
|
|
8
|
+
#
|
|
9
|
+
# Note that we will ONLY store entries that have a simple name associated
|
|
10
|
+
# with them; reason being that human folks will preferentially make use
|
|
11
|
+
# of that name alone.
|
|
12
|
+
#
|
|
13
|
+
# The keys should be sorted alphabetically in this file here.
|
|
14
|
+
# =========================================================================== #
|
|
15
|
+
# x = YAML.load_file('kde_colour_palette.yml')
|
|
16
|
+
# =========================================================================== #
|
|
17
|
+
|
|
18
|
+
# =========================================================================== #
|
|
19
|
+
# === a tag
|
|
20
|
+
# =========================================================================== #
|
|
21
|
+
Abyss Blue:
|
|
22
|
+
- '#2980b9'
|
|
23
|
+
-
|
|
24
|
+
- 41
|
|
25
|
+
- 128
|
|
26
|
+
- 18
|
|
27
|
+
|
|
28
|
+
Alternate Grey:
|
|
29
|
+
- '#bdc3c7'
|
|
30
|
+
-
|
|
31
|
+
- 189
|
|
32
|
+
- 195
|
|
33
|
+
- 199
|
|
34
|
+
|
|
35
|
+
# =========================================================================== #
|
|
36
|
+
# === b tag
|
|
37
|
+
# =========================================================================== #
|
|
38
|
+
Beware Orange:
|
|
39
|
+
- '#f67400'
|
|
40
|
+
-
|
|
41
|
+
- 246
|
|
42
|
+
- 116
|
|
43
|
+
- 0
|
|
44
|
+
|
|
45
|
+
Burnt Charcoal:
|
|
46
|
+
- '#3b4045'
|
|
47
|
+
-
|
|
48
|
+
- 59
|
|
49
|
+
- 64
|
|
50
|
+
- 69
|
|
51
|
+
|
|
52
|
+
# =========================================================================== #
|
|
53
|
+
# === c tag
|
|
54
|
+
# =========================================================================== #
|
|
55
|
+
Cardboard Grey:
|
|
56
|
+
- '#eff0f1'
|
|
57
|
+
-
|
|
58
|
+
- 239
|
|
59
|
+
- 240
|
|
60
|
+
- 241
|
|
61
|
+
|
|
62
|
+
Charcoal Grey:
|
|
63
|
+
- '#31363b'
|
|
64
|
+
-
|
|
65
|
+
- 49
|
|
66
|
+
- 54
|
|
67
|
+
- 59
|
|
68
|
+
|
|
69
|
+
Coastal Fog:
|
|
70
|
+
- '#7f8c8d'
|
|
71
|
+
-
|
|
72
|
+
- 127
|
|
73
|
+
- 140
|
|
74
|
+
- 141
|
|
75
|
+
|
|
76
|
+
# =========================================================================== #
|
|
77
|
+
# === d tag
|
|
78
|
+
# =========================================================================== #
|
|
79
|
+
Deco Blue:
|
|
80
|
+
- '#1e92ff'
|
|
81
|
+
-
|
|
82
|
+
- 30
|
|
83
|
+
- 146
|
|
84
|
+
- 255
|
|
85
|
+
|
|
86
|
+
# =========================================================================== #
|
|
87
|
+
# === h tag
|
|
88
|
+
# =========================================================================== #
|
|
89
|
+
Hover Blue:
|
|
90
|
+
- '#93cee9'
|
|
91
|
+
-
|
|
92
|
+
- 147
|
|
93
|
+
- 206
|
|
94
|
+
- 233
|
|
95
|
+
|
|
96
|
+
Hyper Blue:
|
|
97
|
+
- '#3daee6'
|
|
98
|
+
-
|
|
99
|
+
- 61
|
|
100
|
+
- 174
|
|
101
|
+
- 230
|
|
102
|
+
|
|
103
|
+
# =========================================================================== #
|
|
104
|
+
# === i tag
|
|
105
|
+
# =========================================================================== #
|
|
106
|
+
Icon Blue:
|
|
107
|
+
- '#1d99f3'
|
|
108
|
+
-
|
|
109
|
+
- 29
|
|
110
|
+
- 153
|
|
111
|
+
- 243
|
|
112
|
+
|
|
113
|
+
Icon Green:
|
|
114
|
+
- '#2ecc71'
|
|
115
|
+
-
|
|
116
|
+
- 46
|
|
117
|
+
- 204
|
|
118
|
+
- 113
|
|
119
|
+
|
|
120
|
+
Icon Grey:
|
|
121
|
+
- '#4d4d4d'
|
|
122
|
+
-
|
|
123
|
+
- 77
|
|
124
|
+
- 77
|
|
125
|
+
- 77
|
|
126
|
+
|
|
127
|
+
Icon Red:
|
|
128
|
+
- '#da4453'
|
|
129
|
+
-
|
|
130
|
+
- 218
|
|
131
|
+
- 68
|
|
132
|
+
- 83
|
|
133
|
+
|
|
134
|
+
Icon Yellow:
|
|
135
|
+
- '#fdbc4b'
|
|
136
|
+
-
|
|
137
|
+
- 253
|
|
138
|
+
- 188
|
|
139
|
+
- 75
|
|
140
|
+
|
|
141
|
+
# =========================================================================== #
|
|
142
|
+
# === l tag
|
|
143
|
+
# =========================================================================== #
|
|
144
|
+
Lazy Grey:
|
|
145
|
+
- '#afb0b3'
|
|
146
|
+
-
|
|
147
|
+
- 175
|
|
148
|
+
- 176
|
|
149
|
+
- 179
|
|
150
|
+
|
|
151
|
+
# =========================================================================== #
|
|
152
|
+
# === n tag
|
|
153
|
+
# =========================================================================== #
|
|
154
|
+
Noble Fir:
|
|
155
|
+
- '#27ae60'
|
|
156
|
+
-
|
|
157
|
+
- 39
|
|
158
|
+
- 174
|
|
159
|
+
- 96
|
|
160
|
+
|
|
161
|
+
# =========================================================================== #
|
|
162
|
+
# === p tag
|
|
163
|
+
# =========================================================================== #
|
|
164
|
+
Paper White:
|
|
165
|
+
- '#fcfcfc'
|
|
166
|
+
-
|
|
167
|
+
- 252
|
|
168
|
+
- 252
|
|
169
|
+
- 252
|
|
170
|
+
|
|
171
|
+
Pimpinella:
|
|
172
|
+
- '#e74c3c'
|
|
173
|
+
-
|
|
174
|
+
- 231
|
|
175
|
+
- 76
|
|
176
|
+
- 60
|
|
177
|
+
|
|
178
|
+
Plasma Blue:
|
|
179
|
+
- '#3daee9'
|
|
180
|
+
-
|
|
181
|
+
- 61
|
|
182
|
+
- 174
|
|
183
|
+
- 233
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# =========================================================================== #
|
|
2
|
+
# === prefer_this_colour_schemata.yml
|
|
3
|
+
#
|
|
4
|
+
# This file will determine which colour-schematas the Colours project
|
|
5
|
+
# will prefer, by default. There are only three entries possible,
|
|
6
|
+
# which is :html_colours, :support_for_256_colours and :basic_colours
|
|
7
|
+
#
|
|
8
|
+
# The data structure is kept as a numbered Hash. While it could also be
|
|
9
|
+
# kept as an Array, I wanted to be able to also use [1], [2] and [3]
|
|
10
|
+
# to quickly, cleanly and easily access these entries.
|
|
11
|
+
# =========================================================================== #
|
|
12
|
+
# x = YAML.load_file('prefer_this_colour_schemata.yml')
|
|
13
|
+
# =========================================================================== #
|
|
14
|
+
|
|
15
|
+
1: !ruby/symbol html_colours
|
|
16
|
+
2: !ruby/symbol support_for_256_colours
|
|
17
|
+
3: !ruby/symbol basic_colours
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# =========================================================================== #
|
|
2
|
+
# === use_these_values_for_the_colour_methods.yml
|
|
3
|
+
#
|
|
4
|
+
# This yaml file will contain which colour codes we may use for when we
|
|
5
|
+
# wish to make use of HTML colours.
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
# x = YAML.load_file('use_these_values_for_the_colour_methods.yml')
|
|
8
|
+
# =========================================================================== #
|
|
9
|
+
simp: !ruby/symbol steelblue
|
|
10
|
+
sdir: !ruby/symbol olivedrab
|
|
11
|
+
sfile: !ruby/symbol slateblue
|
|
12
|
+
swarn: !ruby/symbol orangered
|
|
13
|
+
sfancy: !ruby/symbol lightseagreen
|
|
14
|
+
sargument: !ruby/symbol slategray
|
|
15
|
+
ssymlink: !ruby/symbol mediumorchid
|
data/lib/colours.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'colours/requires/require_the_project.rb'
|
data/test/test.html
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
|
|
5
|
+
This is a paragraph in some <slateblue>slateblue</> colour
|
|
6
|
+
and also in <darkgreen>darkgreen</> colour and, last
|
|
7
|
+
but not least, .
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
It continues here with a <chartreuse>chartreuse</> colour.
|
|
11
|
+
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p>
|
|
15
|
+
And here as well with a <papaya>papaya</> colour.
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'new_colours/test/testing_256_colours_support.rb'
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
require 'colours/256_colours/support_for_256_colours.rb'
|
|
8
|
+
|
|
9
|
+
alias e puts
|
|
10
|
+
|
|
11
|
+
e 'Now testing 256 colours support.'
|
|
12
|
+
|
|
13
|
+
# =========================================================================== #
|
|
14
|
+
# === test_256_colours_support
|
|
15
|
+
# =========================================================================== #
|
|
16
|
+
def test_256_colours_support
|
|
17
|
+
Colours.display_this_256_colour(0) { :newline }
|
|
18
|
+
Colours.display_this_256_colour(1) { :newline }
|
|
19
|
+
Colours.display_this_256_colour(2) { :newline }
|
|
20
|
+
Colours.display_this_256_colour(3) { :newline }
|
|
21
|
+
Colours.display_this_256_colour(155) { :newline }
|
|
22
|
+
Colours.display_this_256_colour(rand(255+1)) { :newline }
|
|
23
|
+
e
|
|
24
|
+
Colours.show_all_256_colours { :newline }
|
|
25
|
+
e
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test_256_colours_support
|
|
29
|
+
# test_256_colours_support
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
require 'colours'
|
|
6
|
+
|
|
7
|
+
alias e puts
|
|
8
|
+
|
|
9
|
+
x = 'Test string.'
|
|
10
|
+
|
|
11
|
+
result1 = Colours.bold(x+' Bold.')
|
|
12
|
+
result2 = Colours.return_italic(x+' Italic.')
|
|
13
|
+
result3 = Colours.return_underline(x+' Underline.')
|
|
14
|
+
|
|
15
|
+
e '-'*80
|
|
16
|
+
e result1
|
|
17
|
+
pp result1
|
|
18
|
+
e '-'*80
|
|
19
|
+
e result2
|
|
20
|
+
pp result2
|
|
21
|
+
e '-'*80
|
|
22
|
+
e result3
|
|
23
|
+
pp result3
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# echo -e "\e[1mbold\e[0m"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
require 'colours'
|
|
6
|
+
|
|
7
|
+
alias e puts
|
|
8
|
+
|
|
9
|
+
# x = Colours('This is bright blue.').blue.bright
|
|
10
|
+
# y = x.build_the_main_string
|
|
11
|
+
e Colours('This is blue.').blue
|
|
12
|
+
e Colours('This is blue underline.').blue.underline
|
|
13
|
+
e Colours('This is bright blue underline.').blue.bright.underline
|
|
14
|
+
e Colours('This is bright blue.').blue.bright
|
|
15
|
+
e Colours('This is bright blue.').blue.bright+
|
|
16
|
+
Colours(' And this is bright yellow.').yellow.bright
|
|
17
|
+
e Colours('This is bright blue.').blue.bright+
|
|
18
|
+
Colours(' And this is bright yellow.').yellow.bright+
|
|
19
|
+
Colours(' And this is green.').green
|
|
20
|
+
e Colours('This is bright blue.').blue.bright+
|
|
21
|
+
Colours(' And this is bright yellow.').yellow.bright+
|
|
22
|
+
Colours(' And this is green.').green+
|
|
23
|
+
Colours(' And this is bright green.').green.bright
|
|
24
|
+
e Colours('This is bright blue.').blue.bright+
|
|
25
|
+
Colours(' And this is bright yellow.').yellow.bright+
|
|
26
|
+
Colours(' And this is green.').green+
|
|
27
|
+
Colours(' And this is bright green.').green.bright+
|
|
28
|
+
Colours(' And this is magenta, italic.').magenta.italic
|
|
29
|
+
e Colours('This is blue bright underline.').blue.bright.underline
|
|
30
|
+
e Colours('This is blue bright underline and italic.').blue.bright.underline.italic
|
|
31
|
+
e Colours('This is blue bright and italic.').blue.bright.italic
|
|
32
|
+
e Colours("this is red").red + " and " +
|
|
33
|
+
Colours("this on yellow bg").bg(:yellow) + " and " +
|
|
34
|
+
Colours('even bright underlined!').underline.bright+
|
|
35
|
+
Colours(' Again!').underline.bright.red
|
|
36
|
+
e Colours('This is red.').red+' '+
|
|
37
|
+
Colours('And this should be reversed').red.reversed
|
|
38
|
+
e Colours('This is blue.').blue
|
|
39
|
+
result = Colours('This is blue and bold.').blue.bold
|
|
40
|
+
e result
|
|
41
|
+
e 'Also showing the Escape code for this ^^^'
|
|
42
|
+
pp result.to_s
|
|
43
|
+
result = Colours('This is just bold.').bold
|
|
44
|
+
e result
|
|
45
|
+
e 'Also showing the Escape code for this ^^^'
|
|
46
|
+
pp result.to_s
|
data/test/testing_col.rb
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# Code in this file will test the Colours.col() method.
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
require 'new_colours/toplevel_methods/col.rb'
|
|
8
|
+
|
|
9
|
+
puts NewColours.col '/home/x/songs/'
|
|
10
|
+
puts NewColours.col '/home/x/songs/Westbam_Sunshine.mp3'
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# The test-code resides in colours/lib/colours/test.rb so we can just
|
|
6
|
+
# call Colours.test
|
|
7
|
+
# =========================================================================== #
|
|
8
|
+
if __FILE__ == $PROGRAM_NAME
|
|
9
|
+
|
|
10
|
+
require 'colours/autoinclude'
|
|
11
|
+
|
|
12
|
+
alias ee print
|
|
13
|
+
|
|
14
|
+
# ========================================================================= #
|
|
15
|
+
# === cliner
|
|
16
|
+
# ========================================================================= #
|
|
17
|
+
def cliner
|
|
18
|
+
::Colours.cliner
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# ========================================================================= #
|
|
22
|
+
# === Testing Colours.ecomment() next
|
|
23
|
+
# ========================================================================= #
|
|
24
|
+
cliner
|
|
25
|
+
e 'This file will test the colour gem.'
|
|
26
|
+
e
|
|
27
|
+
e 'Next, this file will test for the method Colours.ecomment()'
|
|
28
|
+
e 'being able to process multiple lines in one go:'
|
|
29
|
+
cliner
|
|
30
|
+
::Colours.ecomment '
|
|
31
|
+
|
|
32
|
+
--ncards? # How many cards are available
|
|
33
|
+
# ^^^ If you pass an argument, then we will use that as name for the card set.
|
|
34
|
+
merge in all yaml files # To merge in all yaml files
|
|
35
|
+
html # To generate the .html page
|
|
36
|
+
zip # To create a big .zip file
|
|
37
|
+
|
|
38
|
+
'
|
|
39
|
+
|
|
40
|
+
# cliner # <-- This cliner is superfluous because Colours.test() will already show one.
|
|
41
|
+
e 'Next, Colours.test() will be invoked:'
|
|
42
|
+
e
|
|
43
|
+
Colours.test # Invoke the Colours.test() class method.
|
|
44
|
+
e Colours.bold_white('This text here should be in bold white.')
|
|
45
|
+
cliner
|
|
46
|
+
e 'Next testing Colours::AnsiColours'
|
|
47
|
+
i = "08.01.2015, 01:16:25 \e[1;32mNo registered users\e[0;0m\e[0;37m."
|
|
48
|
+
e 'Available colours:'
|
|
49
|
+
Colours::ARRAY_REGISTERED_ANSI_COLOURS.each {|colour|
|
|
50
|
+
e colour.inspect+' '+colour+'<- Colourtest.'
|
|
51
|
+
}
|
|
52
|
+
e 'Next we will test a string with AnsiEscape sequences.'
|
|
53
|
+
e 'We wish to get rid of them.'
|
|
54
|
+
pp i
|
|
55
|
+
ee '(1) '
|
|
56
|
+
e Colours.remove(i)
|
|
57
|
+
ee '(2) '
|
|
58
|
+
e i.gsub(REMOVE_ANSI_ESCAPE_CHARACTERS, '') # This regex also works.
|
|
59
|
+
e Colours::TEAL+'Teal'+Colours::REVERT
|
|
60
|
+
# ========================================================================= #
|
|
61
|
+
# === Next test the HtmlColours submodule
|
|
62
|
+
# ========================================================================= #
|
|
63
|
+
cliner
|
|
64
|
+
e 'Next testing the html colours subcomponent of module Colours:'
|
|
65
|
+
e 'Featuring '+simp('Colours::HtmlColours.sample')+' next:'
|
|
66
|
+
e Colours::HtmlColours.sample
|
|
67
|
+
e
|
|
68
|
+
e Colours::HtmlColours::HTML_COLOURS.size
|
|
69
|
+
pp Colours::HtmlColours[]
|
|
70
|
+
cliner
|
|
71
|
+
# ========================================================================= #
|
|
72
|
+
# === Next test the old ColourAid module
|
|
73
|
+
# ========================================================================= #
|
|
74
|
+
cliner
|
|
75
|
+
e 'Hello World! We will now test sfancy() simp() swarn() and ssymlink():'
|
|
76
|
+
cliner
|
|
77
|
+
e 'How do you '+Colours.sfancy('do')+'?'
|
|
78
|
+
e 'How do you '+Colours.simp('do')+'?'
|
|
79
|
+
e 'How do you '+Colours.swarn('do')+'?'
|
|
80
|
+
e 'How do you '+Colours.ssymlink('do')+'?'
|
|
81
|
+
cliner
|
|
82
|
+
e 'How do you '+sfancy('do')+'?'
|
|
83
|
+
e 'How do you '+simp('do')+'?'
|
|
84
|
+
e 'How do you '+swarn('do')+'?'
|
|
85
|
+
e 'How do you '+ssymlink('do')+'?'
|
|
86
|
+
cliner
|
|
87
|
+
e 'Next testing efancy(), eimp(), ewarn() and esymlink().'
|
|
88
|
+
efancy 'All is fine.'
|
|
89
|
+
eimp 'You are doing great!'
|
|
90
|
+
ewarn 'Red Alert!'
|
|
91
|
+
esymlink 'yo there'
|
|
92
|
+
e 'Next, we will test Colours.eparse()'
|
|
93
|
+
Colours.eparse(' - s[number] # start to cut at this '\
|
|
94
|
+
'start-position in seconds - example: s5')
|
|
95
|
+
e Colours.fancy_parse('<lightgreen><i>E. coli</i></lightgreen>')
|
|
96
|
+
end # test_colours
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
require 'colours/everything/autoinclude'
|
|
6
|
+
|
|
7
|
+
e
|
|
8
|
+
e 'This code-snippet will test the '+Colours.gold('e()')+
|
|
9
|
+
' method and various colour-related'
|
|
10
|
+
e 'methods, such as sfancy() or simp()'
|
|
11
|
+
e
|
|
12
|
+
e 'Testing ... '+sfancy('Testing ...')+simp(' some more testing ...')
|
|
13
|
+
e
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
alias e puts
|
|
6
|
+
|
|
7
|
+
require 'colours/eparse/eparse.rb'
|
|
8
|
+
|
|
9
|
+
e
|
|
10
|
+
Colours.eparse('Hello there # how do you do, this is a test')
|
|
11
|
+
e
|
|
12
|
+
Colours.eparse('And this variant has no special token')
|
|
13
|
+
e
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
require 'colours'
|
|
6
|
+
|
|
7
|
+
alias e puts
|
|
8
|
+
|
|
9
|
+
e
|
|
10
|
+
e "#{Colours.rev}First, we will show the code used by Colours.rev():"
|
|
11
|
+
e
|
|
12
|
+
pp Colours.rev
|
|
13
|
+
e
|
|
14
|
+
|
|
15
|
+
e '='*80
|
|
16
|
+
x = '<i>in-vitro</i>-F <steelblue>abcdef</steelblue> And some more here ...'
|
|
17
|
+
result = Colours.rev+
|
|
18
|
+
Colours.fancy_parse(x)
|
|
19
|
+
pp result
|
|
20
|
+
e result
|
|
21
|
+
e '='*80
|
|
22
|
+
|
|
23
|
+
x = '- Es gibt den <i>E. coli</i> Stamm <lightblue>BL21</lightblue> der in der Gentechnik eingesetzt wird. <tomato>Wieso</tomato>? Er ist ein <one>Protease-armer Stamm</one>.'
|
|
24
|
+
result = Colours.rev+
|
|
25
|
+
Colours.fancy_parse(x)
|
|
26
|
+
pp result
|
|
27
|
+
e result
|
|
28
|
+
e '='*80
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
require 'colours/autoinclude'
|
|
6
|
+
|
|
7
|
+
e 'Now testing the component called `kde_colour_palette`.'
|
|
8
|
+
text = 'The cat jumps over the fence.'
|
|
9
|
+
e
|
|
10
|
+
Colours.eabyss_blue(text+' (abyss_blue)')
|
|
11
|
+
Colours.ealternate_grey(text+' (alternate_grey)')
|
|
12
|
+
Colours.ebeware_orange(text+' (beware_orange)')
|
|
13
|
+
Colours.eburnt_charcoal(text+' (burnt_charcoal)')
|
|
14
|
+
Colours.ecardboard_grey(text+' (cardboard_grey)')
|
|
15
|
+
Colours.echarcoal_grey(text+' (charcoal_grey)')
|
|
16
|
+
Colours.ecoastal_fog(text+' (coastal_fog)')
|
|
17
|
+
Colours.edeco_blue(text+' (deco_blue)')
|
|
18
|
+
Colours.ehover_blue(text+' (hover_blue)')
|
|
19
|
+
Colours.ehyper_blue(text+' (hyper_blue)')
|
|
20
|
+
Colours.eicon_blue(text+' (icon_blue)')
|
|
21
|
+
Colours.eicon_green(text+' (icon_green)')
|
|
22
|
+
Colours.eicon_grey(text+' (icon_grey)')
|
|
23
|
+
Colours.eicon_red(text+' (icon_red)')
|
|
24
|
+
Colours.eicon_yellow(text+' (icon_yellow)')
|
|
25
|
+
Colours.elazy_grey(text+' (lazy_grey)')
|
|
26
|
+
Colours.enoble_fir(text+' (noble_fir)')
|
|
27
|
+
Colours.epaper_white(text+' (paper_white)')
|
|
28
|
+
Colours.epimpinella(text+' (pimpinella)')
|
|
29
|
+
Colours.eplasma_blue(text+' (plasma_blue)')
|
|
30
|
+
e
|