colours 0.8.12 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +331 -200
  3. data/bin/colours +2 -2
  4. data/bin/show_basic_colour_palette +7 -0
  5. data/colours.gemspec +1 -2
  6. data/doc/README.gen +294 -178
  7. data/doc/how_to_pick_your_own_colours/how_to_pick_your_own_colours.md +33 -0
  8. data/lib/colours/autoalias_e.rb +4 -1
  9. data/lib/colours/autogenerated/256_colours_instance_methods.rb +1429 -0
  10. data/lib/colours/autogenerated/256_colours_methods.rb +1429 -0
  11. data/lib/colours/autogenerated/html_colours_instance_methods.rb +1191 -0
  12. data/lib/colours/autogenerated/html_colours_methods.rb +1191 -0
  13. data/lib/colours/base/base.rb +61 -13
  14. data/lib/colours/class/colours.rb +8 -6
  15. data/lib/colours/{toplevel_methods/use_colours.rb → colour/colour.rb} +4 -125
  16. data/lib/colours/commandline/README.md +2 -1
  17. data/lib/colours/commandline/commandline.rb +177 -34
  18. data/lib/colours/constants/constants.rb +752 -6
  19. data/lib/colours/e/README.md +6 -6
  20. data/lib/colours/eparse/eparse.rb +2 -1
  21. data/lib/colours/essentials/README.md +5 -0
  22. data/lib/colours/{basic_colours/basic_colours.rb → essentials/essentials.rb} +87 -85
  23. data/lib/colours/html_colours/README.md +2 -1
  24. data/lib/colours/html_colours/hash_html_colours.rb +168 -0
  25. data/lib/colours/html_colours/html_colours.rb +226 -244
  26. data/lib/colours/html_colours/push_the_html_colours_methods_onto_the_toplevel_namespace.rb +30 -0
  27. data/lib/colours/html_colours/random_html_colour.rb +67 -0
  28. data/lib/colours/{requires/require_the_basic_colours.rb → html_colours.rb} +4 -2
  29. data/lib/colours/map_symbol_to_corresponding_colour/map_symbol_to_corresponding_colour.rb +12 -10
  30. data/lib/colours/module_256_colours/module_256_colours.rb +465 -0
  31. data/lib/colours/project/project.rb +3 -1
  32. data/lib/colours/rainbow_colours/check_for_trollop_being_available_or_exit.rb +4 -0
  33. data/lib/colours/rainbow_colours/constants.rb +3 -3
  34. data/lib/colours/rainbow_colours/do_parse_via_rainbow_colours.rb +9 -10
  35. data/lib/colours/rainbow_colours/print_rainbow_line.rb +4 -4
  36. data/lib/colours/rainbow_colours/println_ani.rb +7 -7
  37. data/lib/colours/rainbow_colours/println_plain.rb +2 -2
  38. data/lib/colours/rainbow_colours/rainbow.rb +31 -1
  39. data/lib/colours/rainbow_colours/report_errors.rb +7 -7
  40. data/lib/colours/rainbow_colours/returnln_plain.rb +3 -3
  41. data/lib/colours/replace_tokens_with_colour_code/replace_tokens_with_colour_code.rb +409 -0
  42. data/lib/colours/requires/require_autogenerated_colour_methods.rb +4 -1
  43. data/lib/colours/requires/{require_the_colour_table.rb → require_essentials.rb} +2 -2
  44. data/lib/colours/requires/require_save_file.rb +11 -0
  45. data/lib/colours/requires/require_the_256_colours_module.rb +1 -3
  46. data/lib/colours/requires/require_the_colour_methods.rb +1 -22
  47. data/lib/colours/requires/require_the_project.rb +31 -29
  48. data/lib/colours/requires/require_the_toplevel_methods.rb +2 -20
  49. data/lib/colours/rgb/rgb.rb +107 -89
  50. data/lib/colours/{colour_methods/colour_methods.rb → sfile_sdir_sfancy_swarn_simp_scomments_and_ssymlink/sfile_sdir_sfancy_swarn_simp_scomments_and_ssymlink.rb} +467 -405
  51. data/lib/colours/testing/testing.rb +1 -3
  52. data/lib/colours/toplevel_methods/e.rb +9 -13
  53. data/lib/colours/toplevel_methods/map_this_symbol_to_that_html_colour.rb +57 -0
  54. data/lib/colours/toplevel_methods/{revert.rb → rev.rb} +5 -48
  55. data/lib/colours/toplevel_methods/toplevel_methods.rb +1204 -0
  56. data/lib/colours/version/version.rb +2 -2
  57. data/lib/colours/yaml/256_colours.yml +776 -257
  58. data/lib/colours/yaml/html_colours.yml +1 -1
  59. data/lib/colours/yaml/prefer_this_colour_schemata.yml +1 -1
  60. data/lib/colours/yaml/use_these_values_for_the_colour_methods.yml +5 -1
  61. data/lib/colours.rb +1 -1
  62. data/test/testing_256_colours_support.rb +10 -1
  63. data/test/testing_replace_number_words_with_the_corresponding_html_colour.rb +15 -9
  64. data/test/testing_the_colour_methods_such_as_simp_sdir_sfile_swarn_sfancy_sargument_and_ssymlink.rb +53 -0
  65. metadata +30 -57
  66. data/doc/HOW_TO_PICK_YOUR_OWN_COLOURS.md +0 -28
  67. data/lib/colours/256_colours/support_for_256_colours.rb +0 -196
  68. data/lib/colours/autogenerated/support_for_256_colours.rb +0 -2235
  69. data/lib/colours/autogenerated/support_for_html_colours.rb +0 -1778
  70. data/lib/colours/autogenerated/toplevel_basic_colour_methods.rb +0 -7001
  71. data/lib/colours/basic_colours/README.md +0 -4
  72. data/lib/colours/colour_methods/README.md +0 -11
  73. data/lib/colours/colour_table/README.md +0 -2
  74. data/lib/colours/colour_table/colour_table.rb +0 -282
  75. data/lib/colours/commandline/menu.rb +0 -122
  76. data/lib/colours/constants/escape.rb +0 -22
  77. data/lib/colours/constants/file_constants.rb +0 -73
  78. data/lib/colours/constants/hash_ansi_colours.rb +0 -39
  79. data/lib/colours/constants/hash_simple_colours.rb +0 -148
  80. data/lib/colours/constants/misc.rb +0 -361
  81. data/lib/colours/constants/newline.rb +0 -14
  82. data/lib/colours/constants/registered_colour_methods.rb +0 -53
  83. data/lib/colours/html_colours/add_html_colours_onto_the_toplevel_namespace.rb +0 -22
  84. data/lib/colours/toplevel_methods/autogenerate.rb +0 -310
  85. data/lib/colours/toplevel_methods/bold.rb +0 -41
  86. data/lib/colours/toplevel_methods/bold_and_italic.rb +0 -38
  87. data/lib/colours/toplevel_methods/cat.rb +0 -39
  88. data/lib/colours/toplevel_methods/clear_screen.rb +0 -18
  89. data/lib/colours/toplevel_methods/cliner.rb +0 -17
  90. data/lib/colours/toplevel_methods/col.rb +0 -54
  91. data/lib/colours/toplevel_methods/esystem.rb +0 -19
  92. data/lib/colours/toplevel_methods/html_colour_to_hex_value.rb +0 -41
  93. data/lib/colours/toplevel_methods/html_colourize.rb +0 -69
  94. data/lib/colours/toplevel_methods/is_on_roebe.rb +0 -16
  95. data/lib/colours/toplevel_methods/italic.rb +0 -110
  96. data/lib/colours/toplevel_methods/make_colour.rb +0 -28
  97. data/lib/colours/toplevel_methods/methods_related_to_html_colours.rb +0 -336
  98. data/lib/colours/toplevel_methods/misc.rb +0 -226
  99. data/lib/colours/toplevel_methods/open_this_file.rb +0 -26
  100. data/lib/colours/toplevel_methods/prefer_this_colour_schemata.rb +0 -88
  101. data/lib/colours/toplevel_methods/random_value.rb +0 -37
  102. data/lib/colours/toplevel_methods/remove_escape_sequence.rb +0 -112
  103. data/lib/colours/toplevel_methods/set_last_colour_used.rb +0 -32
  104. data/lib/colours/toplevel_methods/shell_file_containing_the_html_colours.sh +0 -148
  105. data/lib/colours/toplevel_methods/show_basic_colour_palette.rb +0 -36
  106. data/lib/colours/toplevel_methods/underline.rb +0 -130
  107. data/test/testing_the_colour_methods.rb +0 -36
  108. /data/doc/{COLOUR_CODES_CHART.md → colour_codes_chart/colour_codes_chart.md} +0 -0
@@ -1,4 +0,0 @@
1
- Code in this directory will be for "basic" colour support in terminals.
2
-
3
- This primarily refers to plain ANSI escape codes, such as 0;33m for
4
- the colour yellow.
@@ -1,11 +0,0 @@
1
- This directory will hold the representations for sdir(), sfancy(),
2
- sfile() and so forth. These methods are the default "colour methods",
3
- string methods that can be used on the "Colours" namespace directly,
4
- such as:
5
-
6
- Colours.sfancy()
7
- Colours.simportant()
8
- Colours.sdir()
9
- Colours.swarn()
10
-
11
- and so forth.
@@ -1,2 +0,0 @@
1
- This directory will contain code for the colour-table, that is a table that
2
- maps from e. g. sfancy() to the corresponding colour at hand.
@@ -1,282 +0,0 @@
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
- module Colours
8
-
9
- require 'colours/toplevel_methods/use_colours.rb'
10
- require 'colours/html_colours/html_colours.rb'
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
- # === :cyanb
86
- when :cyanb
87
- :lightseagreen
88
- # === :light_grey
89
- when :light_grey
90
- :lightgray
91
- # === :bold_blue
92
- when :bold_blue
93
- :slateblue
94
- when :bold_red, :redb
95
- :crimson
96
- when :bold_yellow
97
- :goldenrod
98
- when :bold_green
99
- :seagreen
100
- else
101
- puts 'Unregistered input into the method '+__method__.to_s+': '+i.to_s
102
- end
103
- end
104
- end
105
-
106
- # ========================================================================= #
107
- # === Colours.map_this_symbol_to_that_256_colour
108
- #
109
- # This method will take input such as :bold_green and associate it with
110
- # a corresponding 256-colour. Thus, the resulting Symbol that is
111
- # found here should correspond to a method on module SupportFor256Colours.
112
- # ========================================================================= #
113
- def self.map_this_symbol_to_that_256_colour(i)
114
- case i
115
- when :boldgreen,
116
- :bold_green
117
- :chartreuse2
118
- when :teal
119
- :teal
120
- when :bold_yellow
121
- :yellow2
122
- when :gold
123
- :gold3
124
- when :bold_blue
125
- :lightslateblue
126
- when :bold_brown
127
- :darkred
128
- when :brown
129
- :maroon
130
- when :pink
131
- :hotpink3
132
- when :lightgrey,
133
- :light_grey
134
- :grey66
135
- when :bold_red
136
- :red1
137
- when :lightblue,
138
- :light_blue
139
- :deepskyblue3
140
- when :grey
141
- :grey53
142
- when :green
143
- :chartreuse4
144
- else
145
- puts "Not known input to method #{__method__.to_s}: #{i}"
146
- end
147
- end
148
-
149
- # ========================================================================= #
150
- # === use_new_colour_codes
151
- #
152
- # Use this method to assign new colour codes.
153
- # We assume that you must pass a hash to this method.
154
- #
155
- # Usage example:
156
- #
157
- # new_hash = {
158
- # :sfancy => 'green',
159
- # :simportant => 'teal',
160
- # :default_colour => 'grey',
161
- # :sfile => 'magenta',
162
- # :sdir => 'cyan'
163
- # }
164
- # Colours.assign_new_colour_codes(new_hash)
165
- #
166
- # ========================================================================= #
167
- def use_new_colour_codes(
168
- i = HASH_NEW_COLOURS
169
- )
170
- @colour_table.update(i)
171
- end; alias assign_new_colour_codes use_new_colour_codes # === assign_new_colour_codes
172
-
173
- # ========================================================================= #
174
- # === Colours.set_colour_table
175
- #
176
- # This method can be used to modify the instance variable
177
- # @colour_table.
178
- #
179
- # The input to this method should be a Hash. It can also be a Symbol,
180
- # in which case we will try to find a Hash that corresponds to that
181
- # Symbol.
182
- #
183
- # If in doubt, pass in a Hash though.
184
- # ========================================================================= #
185
- def self.set_colour_table(
186
- i = :new_colours
187
- )
188
- case i
189
- when :new_colours,
190
- :new_colour_table,
191
- :default
192
- i = HASH_NEW_COLOURS
193
- end
194
- # ======================================================================= #
195
- # Note that we must ensure that all the necessary keys are there
196
- # in the given input. If this is not the case, then we will
197
- # determine which entries are missing, and assign them from the
198
- # instance variable @colour_table.
199
- # ======================================================================= #
200
- missing_entries = (
201
- i.keys - @colour_table.keys
202
- ).flatten
203
- unless missing_entries.empty?
204
- # ===================================================================== #
205
- # Push them onto i in this case.
206
- # ===================================================================== #
207
- missing_entries.each {|this_key|
208
- if i.has_key? this_key
209
- # All fine, pass through in this case.
210
- else
211
- add_this = missing_entries[this_key]
212
- i[key] = add_this
213
-
214
- end
215
- }
216
- end
217
- @colour_table = i
218
- end; self.instance_eval { alias assign_new_colour_codes set_colour_table } # === Colours.assign_new_colour_codes
219
- self.instance_eval { alias set_method_to_colour_table set_colour_table } # === Colours.set_method_to_colour_table
220
-
221
- # ========================================================================= #
222
- # === Colours.use_new_colour_table
223
- # ========================================================================= #
224
- def self.use_new_colour_table
225
- set_colour_table(:new_colour_table)
226
- end
227
-
228
- # ========================================================================= #
229
- # === Colours.show_the_colour_table
230
- #
231
- # This will simply pretty-print the current colour table.
232
- # ========================================================================= #
233
- def self.show_the_colour_table
234
- pp @colour_table
235
- end
236
-
237
- # ========================================================================= #
238
- # === Colours.shuffle
239
- #
240
- # Shuffle the above table. The available colours to take here will
241
- # be from the HtmlColours namespace.
242
- # ========================================================================= #
243
- def self.shuffle
244
- # ======================================================================= #
245
- # Point to the html "table" to use.
246
- # ======================================================================= #
247
- _ = ::Colours::HtmlColours.all?.shuffle
248
- @colour_table = {
249
- simp: _.shift,
250
- sdir: _.shift,
251
- sfile: _.shift,
252
- swarn: _.shift,
253
- sfancy: _.shift,
254
- sargument: _.shift,
255
- ssymlink: _.shift
256
- }
257
- end
258
-
259
- # ========================================================================= #
260
- # === Colours.colour_table?
261
- #
262
- # This method will feedback the available colour-table.
263
- #
264
- # To invoke this method, try the following code:
265
- #
266
- # pp Colours.colours?
267
- #
268
- # ========================================================================= #
269
- def self.colour_table?
270
- @colour_table
271
- end; self.instance_eval { alias method_to_colour_table colour_table? } # === Colours.method_to_colour_table
272
- self.instance_eval { alias method_to_colour_table? colour_table? } # === Colours.method_to_colour_table?
273
- self.instance_eval { alias colours? colour_table? } # === Colours.colours?
274
- self.instance_eval { alias table? colour_table? } # === Colours.table?
275
- self.instance_eval { alias table_colour_methods_to_specific_colour colour_table? } # === Colours.table_colour_methods_to_specific_colour
276
- self.instance_eval { alias colour_methods_to_specific_colour? colour_table? } # === Colours.colour_methods_to_specific_colour?
277
-
278
- end
279
-
280
- if __FILE__ == $PROGRAM_NAME
281
- pp Colours::HASH_NEW_COLOURS
282
- end
@@ -1,122 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'colours/commandline/menu.rb'
6
- # =========================================================================== #
7
- module Colours
8
-
9
- require 'colours/html_colours/html_colours.rb'
10
- require 'colours/toplevel_methods/show_basic_colour_palette.rb'
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 = ::Colours.commandline?
23
- )
24
- if i.is_a? Array
25
- i.each {|entry| menu(entry) }
26
- else
27
- case i # case tag
28
- # ===================================================================== #
29
- # === colours --version
30
- #
31
- # Show the current version of the colours gem.
32
- # ===================================================================== #
33
- when /^-?-?versions?\??$/i
34
- show_the_version
35
- # ===================================================================== #
36
- # === colours --generate_shell_file_containing_the_html_colours
37
- #
38
- # This entry point will autogenerate the shell-file that contains
39
- # the HTML colours (RGB colours).
40
- # ===================================================================== #
41
- when /^-?-?generate(-|_)?shell(-|_)?file(-|_)?containing(-|_)?the(-|_)?html(-|_)?colours$/i,
42
- /^-?-?create(-|_)?shell(-|_)?file$/i # === colours --create-shell-file
43
- generate_shell_file_containing_the_html_colours
44
- # ===================================================================== #
45
- # === colours --show-html_colours
46
- # ===================================================================== #
47
- when /^-?-?show(-|_)?html(-|_)?colours$/i,
48
- /^-?-?show(-|_)?all(-|_)?html(-|_)?colours$/i,
49
- /^-?-?show(-|_)?all(-|_)?colours$/i,
50
- /^-?-?html(-|_)?colours$/i,
51
- 'hcolours',
52
- 'scolours',
53
- 'all',
54
- 'ALL',
55
- '1',
56
- 'ALL_COLOURS',
57
- 'colours?',
58
- 'all_colours',
59
- 'COLOURS',
60
- 'html',
61
- '' # Show all colours here
62
- ::Colours.show_html_colours
63
- exit
64
- # ===================================================================== #
65
- # === colours --basics
66
- # ===================================================================== #
67
- when /^-?-?basics?$/i
68
- ::Colours.show_basic_colour_palette
69
- exit
70
- # ===================================================================== #
71
- # === colours --open
72
- # ===================================================================== #
73
- when 'OPEN',
74
- /^-?-?open$/
75
- open_this_file :then_exit
76
- # ===================================================================== #
77
- # === colours --file?
78
- # ===================================================================== #
79
- when /^-?-?file\??$/i,
80
- 'file','file?'
81
- cliner {
82
- e 'We will next read in from the default file, from:'
83
- e
84
- e " #{sfile(TEST_FILE)}"
85
- e
86
- read_and_display_this_file
87
- }
88
- # ===================================================================== #
89
- # === colours --project_base_directory?
90
- # ===================================================================== #
91
- when /^-?-?project(_|-)?base(_|-)?dir\??$/i,
92
- /^-?-?project(_|-)?base(_|-)?directory\??$/i,
93
- /^-?-?base(_|-)?dir\??$/i
94
- e PROJECT_BASE_DIRECTORY
95
- # ===================================================================== #
96
- # === colours --show-colour-palette
97
- # === colours --palette
98
- #
99
- # This entry point will show the basic colour palette.
100
- # ===================================================================== #
101
- when /^-?-?show(-|_)?colou?r(-|_)?palette$/i,
102
- /^-?-?show(-|_)?palette$/i,
103
- /^-?-?palette$/i
104
- show_colour_palette
105
- # ===================================================================== #
106
- # === colours --help
107
- # ===================================================================== #
108
- when /^-?-?help$/i
109
- show_help
110
- end
111
- end
112
- end; self.instance_eval { alias check_against_menu menu } # === Colours.check_against_menu
113
- # Add an alias to the above. ^^^
114
-
115
- # ========================================================================= #
116
- # === menu (menu tag)
117
- # ========================================================================= #
118
- def menu(i = nil)
119
- ::Colours.menu(i) # Delegate towards the class method above here.
120
- end
121
-
122
- end
@@ -1,22 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal = true
4
- # =========================================================================== #
5
- # require 'colours/constants/escape.rb'
6
- # =========================================================================== #
7
- module Colours
8
-
9
- # ========================================================================= #
10
- # === Colours::ESC
11
- #
12
- # Escape sequences start with the character ESC (ASCII decimal 27/hex
13
- # 0x1B/octal 033).
14
- #
15
- # The characters ESC and [ (left bracket) are called CSI, for "Control
16
- # Sequence Initiator".
17
- #
18
- # Keep in mind that "\e" can be represented via "\u001b" in Ruby, too.
19
- # ========================================================================= #
20
- ESC = "\e["
21
-
22
- end
@@ -1,73 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'colours/constants/file_constants.rb'
6
- # Colours.file_html_colours_to_rgb?
7
- # =========================================================================== #
8
- module Colours
9
-
10
- require 'colours/project/project.rb'
11
-
12
- # ========================================================================= #
13
- # === Colours::FILE_HTML_COLOURS
14
- # ========================================================================= #
15
- FILE_HTML_COLOURS =
16
- "#{PROJECT_BASE_DIRECTORY}yaml/html_colours.yml"
17
-
18
- # ========================================================================= #
19
- # === Colours::FILE_KDE_COLOUR_PALETTE
20
- # ========================================================================= #
21
- FILE_KDE_COLOUR_PALETTE =
22
- "#{PROJECT_BASE_DIRECTORY}yaml/kde_colour_palette.yml"
23
-
24
- # ========================================================================= #
25
- # === Colours::FILE_256_COLOURS
26
- # ========================================================================= #
27
- FILE_256_COLOURS =
28
- "#{PROJECT_BASE_DIRECTORY}yaml/256_colours.yml"
29
-
30
- # ========================================================================= #
31
- # === Colours::FILE_BASIC_COLOURS
32
- # ========================================================================= #
33
- FILE_BASIC_COLOURS =
34
- "#{PROJECT_BASE_DIRECTORY}yaml/basic_colours.yml"
35
-
36
- # ========================================================================= #
37
- # === Colours::FILE_USE_THESE_VALUES_FOR_THE_COLOUR_METHODS
38
- # ========================================================================= #
39
- FILE_USE_THESE_VALUES_FOR_THE_COLOUR_METHODS =
40
- "#{PROJECT_BASE_DIRECTORY}yaml/use_these_values_for_the_colour_methods.yml"
41
-
42
- # ========================================================================= #
43
- # === Colours::FILE_PREFER_THIS_COLOUR_SCHEMATA
44
- # ========================================================================= #
45
- FILE_PREFER_THIS_COLOUR_SCHEMATA =
46
- "#{PROJECT_BASE_DIRECTORY}yaml/prefer_this_colour_schemata.yml"
47
-
48
- # ========================================================================= #
49
- # === Colours.file_html_colours_to_rgb?
50
- #
51
- # Easier toplevel-getter method to determine where the file for
52
- # the html-colours-to-rgb conversion resides.
53
- # ========================================================================= #
54
- def self.file_html_colours_to_rgb?
55
- "#{PROJECT_BASE_DIRECTORY}yaml/html_colours.yml"
56
- end; self.instance_eval { alias file_html_colours file_html_colours_to_rgb? } # === Colours.file_html_colours
57
- self.instance_eval { alias file_html_colours? file_html_colours_to_rgb? } # === Colours.file_html_colours?
58
-
59
- # ========================================================================= #
60
- # === Colours.available_file_constants
61
- # ========================================================================= #
62
- def self.available_file_constants
63
- [
64
- FILE_HTML_COLOURS,
65
- FILE_KDE_COLOUR_PALETTE
66
- ]
67
- end
68
-
69
- end
70
-
71
- if __FILE__ == $PROGRAM_NAME
72
- pp Colours.available_file_constants
73
- end
@@ -1,39 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'colours/constants/hash_ansi_colours.rb'
6
- # =========================================================================== #
7
- module Colours
8
-
9
- # ========================================================================= #
10
- # === HASH_ANSI_COLOURS
11
- # ========================================================================= #
12
- HASH_ANSI_COLOURS = {
13
- black: '30',
14
- red: '31',
15
- green: '32',
16
- brown: '33', # This is also known as yellow.
17
- yellow: '33',
18
- blue: '34',
19
- purple: '35', # Also known as magenta.
20
- magenta: '35',
21
- light_magenta: '35',
22
- cyan: '36',
23
- light_gray: '37',
24
- grey: '37',
25
- white: '37',
26
- light_red: '41',
27
- background_black: '40',
28
- background_red: '41',
29
- background_green: '42',
30
- background_brown: '43',
31
- background_yellow: '43',
32
- background_blue: '44',
33
- light_blue: '44', # Alias to the above ^^^.
34
- background_purple: '45',
35
- background_cyan: '46',
36
- background_white: '47',
37
- }
38
-
39
- end