colours 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of colours might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/LICENCE.md +22 -0
- data/README.md +970 -0
- data/bin/colours +7 -0
- data/bin/html_colour_to_hex_value +7 -0
- data/bin/html_colourize +7 -0
- data/bin/print_rainbow_line +7 -0
- data/bin/rainbow_colours +7 -0
- data/bin/remove_ansii_escape_sequences +7 -0
- data/colours.gemspec +76 -0
- data/doc/COLOUR_CODES_CHART.md +28 -0
- data/doc/HOW_TO_PICK_YOUR_OWN_COLOURS.md +29 -0
- data/doc/README.gen +927 -0
- data/doc/todo/todo.md +25 -0
- data/lib/colours/256_colours/support_for_256_colours.rb +190 -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 +6367 -0
- data/lib/colours/autoinclude.rb +14 -0
- data/lib/colours/base/base.rb +23 -0
- data/lib/colours/basic_colours/README.md +4 -0
- data/lib/colours/basic_colours/basic_colours.rb +334 -0
- data/lib/colours/class/class.rb +125 -0
- data/lib/colours/colour_methods/README.md +11 -0
- data/lib/colours/colour_methods/default_colour.rb +66 -0
- data/lib/colours/colour_methods/sargument.rb +70 -0
- data/lib/colours/colour_methods/scomments.rb +105 -0
- data/lib/colours/colour_methods/sdir.rb +66 -0
- data/lib/colours/colour_methods/sfancy.rb +84 -0
- data/lib/colours/colour_methods/sfile.rb +71 -0
- data/lib/colours/colour_methods/simportant.rb +92 -0
- data/lib/colours/colour_methods/snormal.rb +66 -0
- data/lib/colours/colour_methods/ssymlink.rb +102 -0
- data/lib/colours/colour_methods/swarn.rb +76 -0
- data/lib/colours/colour_table/README.md +3 -0
- data/lib/colours/colour_table/colour_table.rb +275 -0
- data/lib/colours/colours_e_autoinclude.rb +9 -0
- data/lib/colours/commandline/README.md +2 -0
- data/lib/colours/commandline/commandline.rb +44 -0
- data/lib/colours/commandline/menu.rb +111 -0
- data/lib/colours/constants/colour_constants.rb +301 -0
- data/lib/colours/constants/file_constants.rb +72 -0
- data/lib/colours/constants/hash_simple_colours.rb +146 -0
- data/lib/colours/constants/misc.rb +59 -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 +77 -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/hash_html_colours.rb +63 -0
- data/lib/colours/html_colours/html_colourize.rb +48 -0
- data/lib/colours/html_colours/is_this_html_colour_included.rb +64 -0
- data/lib/colours/html_colours/misc.rb +186 -0
- data/lib/colours/html_colours/show_html_colours.rb +85 -0
- data/lib/colours/kde_colour_palette/kde_colour_palette.rb +128 -0
- data/lib/colours/map_symbol_to_corresponding_colour/map_symbol_to_corresponding_colour.rb +219 -0
- data/lib/colours/module.rb +11 -0
- data/lib/colours/project/project_base_directory.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_all_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_sdir.rb +5 -0
- data/lib/colours/requires/require_sfile.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_colours_project.rb +52 -0
- data/lib/colours/requires/require_the_constants.rb +11 -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_toplevel_methods.rb +42 -0
- data/lib/colours/revert/revert.rb +106 -0
- data/lib/colours/rgb/rgb.rb +547 -0
- data/lib/colours/testing/README.md +2 -0
- data/lib/colours/testing/testing.rb +157 -0
- data/lib/colours/toplevel_methods/bold.rb +35 -0
- data/lib/colours/toplevel_methods/bold_and_italic.rb +36 -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 +19 -0
- data/lib/colours/toplevel_methods/col.rb +56 -0
- data/lib/colours/toplevel_methods/e.rb +63 -0
- data/lib/colours/toplevel_methods/esystem.rb +19 -0
- data/lib/colours/toplevel_methods/fancy_parse.rb +83 -0
- data/lib/colours/toplevel_methods/html_colourize.rb +64 -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 +29 -0
- data/lib/colours/toplevel_methods/methods_related_to_html_colours.rb +350 -0
- data/lib/colours/toplevel_methods/misc.rb +156 -0
- data/lib/colours/toplevel_methods/open_this_file.rb +26 -0
- data/lib/colours/toplevel_methods/prefer_this_colour_schemata.rb +84 -0
- data/lib/colours/toplevel_methods/random_html_colour.rb +44 -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/set_last_colour_used.rb +32 -0
- data/lib/colours/toplevel_methods/show_basic_colour_palette.rb +36 -0
- data/lib/colours/toplevel_methods/underline.rb +129 -0
- data/lib/colours/toplevel_methods/use_colours.rb +290 -0
- data/lib/colours/utility_scripts/README.md +2 -0
- data/lib/colours/utility_scripts/autogenerate.rb +291 -0
- data/lib/colours/version/version.rb +25 -0
- data/lib/colours/yaml/256_colours.yml +277 -0
- data/lib/colours/yaml/basic_colours.yml +23 -0
- data/lib/colours/yaml/html_colours.yml +835 -0
- data/lib/colours/yaml/kde_colour_palette.yml +183 -0
- data/lib/colours/yaml/prefer_this_colour_schemata.yml +15 -0
- data/lib/colours/yaml/use_these_values_for_the_colour_methods.yml +15 -0
- data/lib/colours.rb +5 -0
- data/test/test.html +18 -0
- data/test/testing_256_colours_support.rb +29 -0
- data/test/testing_col.rb +10 -0
- data/test/testing_colours.rb +95 -0
- data/test/testing_colours_e.rb +13 -0
- data/test/testing_eparse.rb +13 -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_rgb_to_hex.rb +32 -0
- data/test/testing_the_basic_colours_of_the_colours_project.rb +58 -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_html_colours_of_the_colours_project.rb +37 -0
- data/test/testing_whether_colours_will_be_used.rb +7 -0
- metadata +228 -0
@@ -0,0 +1,275 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'colours/colour_table/colour_table.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'colours/toplevel_methods/use_colours.rb'
|
8
|
+
require 'colours/html_colours/is_this_html_colour_included.rb'
|
9
|
+
|
10
|
+
module Colours
|
11
|
+
|
12
|
+
# ========================================================================= #
|
13
|
+
# === HASH_NEW_COLOURS
|
14
|
+
#
|
15
|
+
# This is the new hash, which we can transition-into when necessary.
|
16
|
+
#
|
17
|
+
# It is only rarely used these days, though (as of the year 2018).
|
18
|
+
#
|
19
|
+
# If you want to use these colours, you can use this simpler API:
|
20
|
+
#
|
21
|
+
# Colourss.set_method_to_colour_table :new_colours
|
22
|
+
#
|
23
|
+
# ========================================================================= #
|
24
|
+
HASH_NEW_COLOURS = {
|
25
|
+
default_colour: :green,
|
26
|
+
sargument: :bold_brown, # === sarg()
|
27
|
+
scomments: :bold_blue, # === scomments()
|
28
|
+
sdir: :bold_green, # === sdir()
|
29
|
+
sfancy: :bold_yellow, # === sfancy()
|
30
|
+
sfile: :brown, # === sfile()
|
31
|
+
simportant: :pink, # === simportant()
|
32
|
+
ssymlink: :teal, # === ssymlink()
|
33
|
+
swarn: :bold_red, # === swarn
|
34
|
+
snormal: :light_grey # === snormal()
|
35
|
+
}
|
36
|
+
|
37
|
+
# ========================================================================= #
|
38
|
+
# === Colours.update_the_colour_codes_with (update tag)
|
39
|
+
# ========================================================================= #
|
40
|
+
def self.update_the_colour_codes_with(i = HASH_NEW_COLOURS)
|
41
|
+
@colour_table.update(i)
|
42
|
+
end; self.instance_eval { alias update_colour_table_with update_the_colour_codes_with } # === Colours.update_colour_table_with
|
43
|
+
self.instance_eval { alias update_the_colour_codes update_the_colour_codes_with } # === Colours.update_the_colour_codes
|
44
|
+
self.instance_eval { alias update_colour_codes update_the_colour_codes_with } # === Colours.update_colour_codes
|
45
|
+
|
46
|
+
# ========================================================================= #
|
47
|
+
# === @colour_table (default tag, default colours tag)
|
48
|
+
#
|
49
|
+
# This toplevel instance variable has the default colours assigned to
|
50
|
+
# the different methods. If you ever wish to change the default colours
|
51
|
+
# in use, you can do so by manipulating this instance variable.
|
52
|
+
#
|
53
|
+
# Keep it sorted alphabetically.
|
54
|
+
# ========================================================================= #
|
55
|
+
@colour_table = {
|
56
|
+
default_colour: :green,
|
57
|
+
sfancy: :bold_green, # === sfancy()
|
58
|
+
sargument: :bold_green, # === sargument()
|
59
|
+
scomments: :grey, # === scomments()
|
60
|
+
sdir: :chocolate, # === sdir()
|
61
|
+
sfile: :saddlebrown, # === sfile()
|
62
|
+
simportant: :gold, # === simportant()
|
63
|
+
ssymlink: :lightblue, # === ssymlink()
|
64
|
+
swarn: :bold_red, # === swarn()
|
65
|
+
snormal: :light_grey # === snormal()
|
66
|
+
}
|
67
|
+
|
68
|
+
if @use_html_colours and File.exist?(FILE_USE_THESE_VALUES_FOR_THE_COLOUR_METHODS)
|
69
|
+
these_colours = YAML.load_file(FILE_USE_THESE_VALUES_FOR_THE_COLOUR_METHODS).
|
70
|
+
transform_keys(&:to_sym)
|
71
|
+
update_colour_table_with(these_colours)
|
72
|
+
end
|
73
|
+
|
74
|
+
# ========================================================================= #
|
75
|
+
# === Colours.map_this_symbol_to_that_html_colour
|
76
|
+
#
|
77
|
+
# The job of this method is to map entries such as :bold_green to
|
78
|
+
# a corresponding HTML colour.
|
79
|
+
# ========================================================================= #
|
80
|
+
def self.map_this_symbol_to_that_html_colour(i)
|
81
|
+
if is_a_html_colour? i
|
82
|
+
i
|
83
|
+
else
|
84
|
+
case i
|
85
|
+
when :cyanb
|
86
|
+
:lightseagreen
|
87
|
+
when :light_grey
|
88
|
+
:lightgray
|
89
|
+
when :bold_blue
|
90
|
+
:slateblue
|
91
|
+
when :bold_red, :redb
|
92
|
+
:crimson
|
93
|
+
when :bold_yellow
|
94
|
+
:goldenrod
|
95
|
+
when :bold_green
|
96
|
+
:seagreen
|
97
|
+
else
|
98
|
+
puts 'Unregistered input into the method '+__method__.to_s+': '+i.to_s
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# ========================================================================= #
|
104
|
+
# === Colours.map_this_symbol_to_that_256_colour
|
105
|
+
#
|
106
|
+
# This method will take input such as :bold_green and associate it with
|
107
|
+
# a corresponding 256-colour. Thus, the resulting Symbol that is
|
108
|
+
# found here should correspond to a method on module SupportFor256Colours.
|
109
|
+
# ========================================================================= #
|
110
|
+
def self.map_this_symbol_to_that_256_colour(i)
|
111
|
+
case i
|
112
|
+
when :boldgreen,
|
113
|
+
:bold_green
|
114
|
+
:chartreuse2
|
115
|
+
when :teal
|
116
|
+
:teal
|
117
|
+
when :bold_yellow
|
118
|
+
:yellow2
|
119
|
+
when :gold
|
120
|
+
:gold3
|
121
|
+
when :bold_blue
|
122
|
+
:lightslateblue
|
123
|
+
when :bold_brown
|
124
|
+
:darkred
|
125
|
+
when :brown
|
126
|
+
:maroon
|
127
|
+
when :pink
|
128
|
+
:hotpink3
|
129
|
+
when :lightgrey,
|
130
|
+
:light_grey
|
131
|
+
:grey66
|
132
|
+
when :bold_red
|
133
|
+
:red1
|
134
|
+
when :lightblue,
|
135
|
+
:light_blue
|
136
|
+
:deepskyblue3
|
137
|
+
when :grey
|
138
|
+
:grey53
|
139
|
+
when :green
|
140
|
+
:chartreuse4
|
141
|
+
else
|
142
|
+
puts "Not known input to method #{__method__.to_s}: #{i}"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# ========================================================================= #
|
147
|
+
# === use_new_colour_codes
|
148
|
+
#
|
149
|
+
# Use this method to assign new colour codes.
|
150
|
+
# We assume that you must pass a hash to this method.
|
151
|
+
#
|
152
|
+
# Usage example:
|
153
|
+
#
|
154
|
+
# new_hash = {
|
155
|
+
# :sfancy => 'green',
|
156
|
+
# :simportant => 'teal',
|
157
|
+
# :default_colour => 'grey',
|
158
|
+
# :sfile => 'magenta',
|
159
|
+
# :sdir => 'cyan'
|
160
|
+
# }
|
161
|
+
# Colours.assign_new_colour_codes(new_hash)
|
162
|
+
#
|
163
|
+
# ========================================================================= #
|
164
|
+
def use_new_colour_codes(
|
165
|
+
i = HASH_NEW_COLOURS
|
166
|
+
)
|
167
|
+
@colour_table.update(i)
|
168
|
+
end; alias assign_new_colour_codes use_new_colour_codes # === assign_new_colour_codes
|
169
|
+
|
170
|
+
# ========================================================================= #
|
171
|
+
# === Colours.set_colour_table
|
172
|
+
#
|
173
|
+
# This method can be used to modify the instance variable
|
174
|
+
# @colour_table.
|
175
|
+
#
|
176
|
+
# The input to this method should be a Hash. It can also be a Symbol,
|
177
|
+
# in which case we will try to find a Hash that corresponds to that
|
178
|
+
# Symbol.
|
179
|
+
#
|
180
|
+
# If in doubt, pass in a Hash though.
|
181
|
+
# ========================================================================= #
|
182
|
+
def self.set_colour_table(
|
183
|
+
i = :new_colours
|
184
|
+
)
|
185
|
+
case i
|
186
|
+
when :new_colours,
|
187
|
+
:new_colour_table,
|
188
|
+
:default
|
189
|
+
i = HASH_NEW_COLOURS
|
190
|
+
end
|
191
|
+
# ======================================================================= #
|
192
|
+
# Note that we must ensure that all the necessary keys are there
|
193
|
+
# in the given input. If this is not the case, then we will
|
194
|
+
# determine which entries are missing, and assign them from the
|
195
|
+
# instance variable @colour_table.
|
196
|
+
# ======================================================================= #
|
197
|
+
missing_entries = (
|
198
|
+
i.keys - @colour_table.keys
|
199
|
+
).flatten
|
200
|
+
unless missing_entries.empty?
|
201
|
+
# ===================================================================== #
|
202
|
+
# Push them onto i in this case.
|
203
|
+
# ===================================================================== #
|
204
|
+
missing_entries.each {|this_key|
|
205
|
+
if i.has_key? this_key
|
206
|
+
# All fine, pass through in this case.
|
207
|
+
else
|
208
|
+
add_this = missing_entries[this_key]
|
209
|
+
i[key] = add_this
|
210
|
+
|
211
|
+
end
|
212
|
+
}
|
213
|
+
end
|
214
|
+
@colour_table = i
|
215
|
+
end; self.instance_eval { alias assign_new_colour_codes set_colour_table } # === Colours.assign_new_colour_codes
|
216
|
+
self.instance_eval { alias set_method_to_colour_table set_colour_table } # === Colours.set_method_to_colour_table
|
217
|
+
|
218
|
+
# ========================================================================= #
|
219
|
+
# === Colours.use_new_colour_table
|
220
|
+
# ========================================================================= #
|
221
|
+
def self.use_new_colour_table
|
222
|
+
set_colour_table(:new_colour_table)
|
223
|
+
end
|
224
|
+
|
225
|
+
# ========================================================================= #
|
226
|
+
# === Colours.show_the_colour_table
|
227
|
+
#
|
228
|
+
# This will simply pretty-print the current colour table.
|
229
|
+
# ========================================================================= #
|
230
|
+
def self.show_the_colour_table
|
231
|
+
pp @colour_table
|
232
|
+
end
|
233
|
+
|
234
|
+
# ========================================================================= #
|
235
|
+
# === Colours.shuffle
|
236
|
+
#
|
237
|
+
# Shuffle the above table. The available colours to take here will
|
238
|
+
# be from the HtmlColours namespace.
|
239
|
+
# ========================================================================= #
|
240
|
+
def self.shuffle
|
241
|
+
# ======================================================================= #
|
242
|
+
# Point to the html "table" to use.
|
243
|
+
# ======================================================================= #
|
244
|
+
_ = ::Colours::HtmlColours.all?.shuffle
|
245
|
+
@colour_table = {
|
246
|
+
simp: _.shift,
|
247
|
+
sdir: _.shift,
|
248
|
+
sfile: _.shift,
|
249
|
+
swarn: _.shift,
|
250
|
+
sfancy: _.shift,
|
251
|
+
sargument: _.shift,
|
252
|
+
ssymlink: _.shift
|
253
|
+
}
|
254
|
+
end
|
255
|
+
|
256
|
+
# ========================================================================= #
|
257
|
+
# === Colours.colour_table?
|
258
|
+
#
|
259
|
+
# This method will feedback the available colour-table.
|
260
|
+
#
|
261
|
+
# To invoke this method, try the following code:
|
262
|
+
#
|
263
|
+
# pp Colours.colours?
|
264
|
+
#
|
265
|
+
# ========================================================================= #
|
266
|
+
def self.colour_table?
|
267
|
+
@colour_table
|
268
|
+
end; self.instance_eval { alias method_to_colour_table colour_table? } # === Colours.method_to_colour_table
|
269
|
+
self.instance_eval { alias method_to_colour_table? colour_table? } # === Colours.method_to_colour_table?
|
270
|
+
self.instance_eval { alias colours? colour_table? } # === Colours.colours?
|
271
|
+
self.instance_eval { alias table? colour_table? } # === Colours.table?
|
272
|
+
self.instance_eval { alias table_colour_methods_to_specific_colour colour_table? } # === Colours.table_colour_methods_to_specific_colour
|
273
|
+
self.instance_eval { alias colour_methods_to_specific_colour? colour_table? } # === Colours.colour_methods_to_specific_colour?
|
274
|
+
|
275
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'colours/colours_e_autoinclude.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'colours/autoinclude'
|
8
|
+
require 'colours/e/autoinclude'
|
9
|
+
require 'colours/module.rb'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'colours/commandline/commandline.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'colours/commandline/menu.rb'
|
8
|
+
require 'colours/eparse/eparse.rb'
|
9
|
+
|
10
|
+
module Colours
|
11
|
+
|
12
|
+
alias e puts
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === Colours.set_commandline
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.set_commandline(i = ARGV)
|
18
|
+
@commandline = [i].flatten.compact
|
19
|
+
end
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === Colours.commandline?
|
23
|
+
# ========================================================================= #
|
24
|
+
def self.commandline?
|
25
|
+
@commandline
|
26
|
+
end
|
27
|
+
|
28
|
+
# ========================================================================= #
|
29
|
+
# === Colours.show_help (help tag)
|
30
|
+
# ========================================================================= #
|
31
|
+
def self.show_help
|
32
|
+
e
|
33
|
+
e 'This menu supports the following commands:'
|
34
|
+
e
|
35
|
+
eparse ' file? # read in from the default test file'
|
36
|
+
eparse ' html_colours # show all html colours'
|
37
|
+
eparse ' open # open this file here in your editor'
|
38
|
+
eparse ' --base-dir? # show the project base directory '\
|
39
|
+
'of the Colours namespace'
|
40
|
+
eparse ' --show-html-colours # show the available HTML colours'
|
41
|
+
e
|
42
|
+
end; self.instance_eval { alias help show_help } # === Colours.help
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'colours/commandline/menu.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'colours/html_colours/show_html_colours.rb'
|
8
|
+
require 'colours/toplevel_methods/show_basic_colour_palette.rb'
|
9
|
+
|
10
|
+
module Colours
|
11
|
+
|
12
|
+
# ========================================================================= #
|
13
|
+
# === Colours.menu (menu tag)
|
14
|
+
#
|
15
|
+
# To invoke this method, try:
|
16
|
+
#
|
17
|
+
# colours --show_html_colours
|
18
|
+
# colours file?
|
19
|
+
#
|
20
|
+
# ========================================================================= #
|
21
|
+
def self.menu(
|
22
|
+
i = @commandline
|
23
|
+
)
|
24
|
+
if i.is_a? Array
|
25
|
+
i.each {|entry| menu(entry) }
|
26
|
+
else
|
27
|
+
case i # case tag
|
28
|
+
# ===================================================================== #
|
29
|
+
# === colours --generate_shell_file_containing_the_html_colours
|
30
|
+
#
|
31
|
+
# This entry point will autogenerate the shell-file that contains
|
32
|
+
# the HTML colours (RGB colours).
|
33
|
+
# ===================================================================== #
|
34
|
+
when /^-?-?generate(-|_)?shell(-|_)?file(-|_)?containing(-|_)?the(-|_)?html(-|_)?colours$/i,
|
35
|
+
/^-?-?create(-|_)?shell(-|_)?file$/i # === colours --create-shell-file
|
36
|
+
generate_shell_file_containing_the_html_colours
|
37
|
+
# ===================================================================== #
|
38
|
+
# === colours --show-html_colours
|
39
|
+
# ===================================================================== #
|
40
|
+
when /^-?-?show(-|_)?html(-|_)?colours$/i,
|
41
|
+
/^-?-?show(-|_)?all(-|_)?html(-|_)?colours$/i,
|
42
|
+
/^-?-?show(-|_)?all(-|_)?colours$/i,
|
43
|
+
/^-?-?html(-|_)?colours$/,
|
44
|
+
'html_colours','htmlcolours','hcolours',
|
45
|
+
'scolours','all','ALL','1','ALL_COLOURS',
|
46
|
+
'colours?',
|
47
|
+
'all_colours',
|
48
|
+
'COLOURS',
|
49
|
+
'html',
|
50
|
+
'' # Show all colours here
|
51
|
+
Colours.show_html_colours
|
52
|
+
exit
|
53
|
+
# ===================================================================== #
|
54
|
+
# === colours --basics
|
55
|
+
# ===================================================================== #
|
56
|
+
when /^-?-?basics?$/i
|
57
|
+
Colours.show_basic_colour_palette
|
58
|
+
exit
|
59
|
+
# ===================================================================== #
|
60
|
+
# === colours --open
|
61
|
+
# ===================================================================== #
|
62
|
+
when 'OPEN',
|
63
|
+
/^-?-?open$/
|
64
|
+
open_this_file :then_exit
|
65
|
+
# ===================================================================== #
|
66
|
+
# === colours --file?
|
67
|
+
# ===================================================================== #
|
68
|
+
when /^-?-?file\??$/i,
|
69
|
+
'file','file?'
|
70
|
+
cliner {
|
71
|
+
e 'We will next read in from the default file, from:'
|
72
|
+
e
|
73
|
+
e " #{sfile(TEST_FILE)}"
|
74
|
+
e
|
75
|
+
read_and_display_this_file
|
76
|
+
}
|
77
|
+
# ===================================================================== #
|
78
|
+
# === colours --project_base_directory?
|
79
|
+
# ===================================================================== #
|
80
|
+
when /^-?-?project(_|-)?base(_|-)?dir\??$/i,
|
81
|
+
/^-?-?project(_|-)?base(_|-)?directory\??$/i,
|
82
|
+
/^-?-?base(_|-)?dir\??$/i
|
83
|
+
e PROJECT_BASE_DIRECTORY
|
84
|
+
# ===================================================================== #
|
85
|
+
# === colours --show-colour-palette
|
86
|
+
# === colours --palette
|
87
|
+
#
|
88
|
+
# This entry point will show the basic colour palette.
|
89
|
+
# ===================================================================== #
|
90
|
+
when /^-?-?show(-|_)?colou?r(-|_)?palette$/i,
|
91
|
+
/^-?-?show(-|_)?palette$/i,
|
92
|
+
/^-?-?palette$/i
|
93
|
+
show_colour_palette
|
94
|
+
# ===================================================================== #
|
95
|
+
# === colours --help
|
96
|
+
# ===================================================================== #
|
97
|
+
when /^-?-?help$/i
|
98
|
+
show_help
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end; self.instance_eval { alias check_against_menu menu } # === Colours.check_against_menu
|
102
|
+
# Add an alias to the above. ^^^
|
103
|
+
|
104
|
+
# ========================================================================= #
|
105
|
+
# === menu (menu tag)
|
106
|
+
# ========================================================================= #
|
107
|
+
def menu(i = nil)
|
108
|
+
Colours.menu(i) # Delegate towards the class method above here.
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|