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
@@ -829,7 +829,7 @@ yellow:
829
829
  - 255
830
830
  - 255
831
831
  - 0
832
- - FFFF00
832
+ - FFFF00
833
833
  yellowgreen:
834
834
  - 154
835
835
  - 205
@@ -11,7 +11,7 @@
11
11
  # =========================================================================== #
12
12
  # x = YAML.load_file('prefer_this_colour_schemata.yml')
13
13
  # =========================================================================== #
14
-
14
+
15
15
  1: !ruby/symbol html_colours
16
16
  2: !ruby/symbol support_for_256_colours
17
17
  3: !ruby/symbol basic_colours
@@ -3,13 +3,17 @@
3
3
  #
4
4
  # This yaml file will contain which colour codes we may use for when we
5
5
  # wish to make use of HTML colours.
6
+ #
7
+ # Keep the !ruby/symbol part here - while it may not be strictly
8
+ # necessary, it helps to remember that we are working with Symbols
9
+ # in this .yml file here.
6
10
  # =========================================================================== #
7
11
  # x = YAML.load_file('use_these_values_for_the_colour_methods.yml')
8
12
  # =========================================================================== #
13
+ sfancy: !ruby/symbol lightseagreen
9
14
  simp: !ruby/symbol steelblue
10
15
  sdir: !ruby/symbol olivedrab
11
16
  sfile: !ruby/symbol slateblue
12
17
  swarn: !ruby/symbol orangered
13
- sfancy: !ruby/symbol lightseagreen
14
18
  sargument: !ruby/symbol slategray
15
19
  ssymlink: !ruby/symbol mediumorchid
data/lib/colours.rb CHANGED
@@ -1 +1 @@
1
- require 'colours/requires/require_the_project.rb'
1
+ require 'colours/requires/require_the_project.rb'
@@ -4,7 +4,9 @@
4
4
  # =========================================================================== #
5
5
  # require 'new_colours/test/testing_256_colours_support.rb'
6
6
  # =========================================================================== #
7
- require 'colours/256_colours/support_for_256_colours.rb'
7
+ require 'colours/module_256_colours/module_256_colours.rb'
8
+ require 'colours/autogenerated/256_colours_instance_methods.rb'
9
+ require 'colours/autogenerated/256_colours_methods.rb'
8
10
 
9
11
  alias e puts
10
12
 
@@ -12,6 +14,8 @@ e 'Now testing 256 colours support.'
12
14
 
13
15
  # =========================================================================== #
14
16
  # === test_256_colours_support
17
+ #
18
+ # This method is used for testing various aspects of the 256-submodule.
15
19
  # =========================================================================== #
16
20
  def test_256_colours_support
17
21
  Colours.display_this_256_colour(0) { :newline }
@@ -23,6 +27,11 @@ def test_256_colours_support
23
27
  e
24
28
  Colours.show_all_256_colours { :newline }
25
29
  e
30
+ include ::Colours::Module256Colours
31
+ e green('This should be in green.')
32
+ e
33
+ e aquamarine3('This should be in aquamarine3.')
34
+ e
26
35
  end
27
36
 
28
37
  test_256_colours_support
@@ -2,22 +2,28 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- require 'colours'
5
+ require 'colours/html_colours'
6
+
6
7
  alias e puts
7
8
 
8
9
  use_this_hash = {
9
- :one => :steelblue,
10
- :two => :mediumseagreen,
11
- :three => :mediumpurple,
12
- :four => :olivedrab,
13
- :five => :lightgreen,
14
- :default_colour => :olivedrab
10
+ one: :steelblue,
11
+ two: :mediumseagreen,
12
+ three: :mediumpurple,
13
+ four: :olivedrab,
14
+ five: :lightgreen,
15
+ default_colour: :olivedrab
15
16
  }
16
- x = 'Contemporary research in animal cognition has as its roots ... where? In <one>Charles Darwin’s theory of evolution by natural selection</one>.'
17
+ x = 'Contemporary <royalblue>research</royalblue> in animal cognition has as '\
18
+ 'its roots ... where? In <one>Charles Darwin’s theory of evolution by natural selection</one>.'
17
19
 
20
+ e
18
21
  e x
22
+ e
19
23
  y = Colours.replace_number_words_with_the_corresponding_html_colour(x, use_this_hash)
24
+ e
20
25
  e y
26
+ e
21
27
 
22
28
  z = '- Is <one>abc</one> <two>an example of</two> <orange>def ghi</orange> or of <orange>jkl mno</orange>? <one>Non-associative learning</one>.'
23
29
  scanned = z.scan(
@@ -30,7 +36,7 @@ scanned.each {|entry|
30
36
  regex_to_use = Colours.return_main_regex_to_use_for_obtaining_the_full_content(colour_to_use)
31
37
  e z.gsub(
32
38
  regex_to_use,
33
- ::Colours::AllColourMethods.send(colour_to_use.to_sym, "\\1") { :omit_end }+
39
+ ::Colours.send(colour_to_use.to_sym, "\\1") { :omit_end }+
34
40
  ::Colours.rev
35
41
  )
36
42
  end
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ alias e puts
6
+ require 'colours'
7
+ rev = Colours.rev
8
+ # =========================================================================== #
9
+ # === ARROW
10
+ # =========================================================================== #
11
+ ARROW = '→'
12
+ # =========================================================================== #
13
+ # === PADDING_TO_USE
14
+ # =========================================================================== #
15
+ PADDING_TO_USE = 58
16
+ e
17
+ e 'The code in this file will test the various colour-methods, such as'
18
+ e 'sfancy(), sdir() and so forth.'
19
+ e
20
+ e "Let's show the colour-table we will be using here:"
21
+ e
22
+ pp ::Colours.colour_table?
23
+ e
24
+ e
25
+ e Colours.sfancy( 'Hello world (through sfancy())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.sfancy('').inspect
26
+ e Colours.sdir( 'Hello world (through sdir())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.sdir('').inspect
27
+ e Colours.simportant('Hello world (through simportant())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.simportant('').inspect
28
+ e Colours.swarn( 'Hello world (through swarn())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.swarn('').inspect
29
+ # e Colours.snormal( 'Hello world (through snormal())')+Colours.snormal('').inspect
30
+ # e Colours.sargument( 'Hello world (through sargument())')+Colours.sargument('').inspect
31
+ # ^^^ these two were removed in November 2023.
32
+ e Colours.sfile( 'Hello world (through sfile())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.sfile('').inspect
33
+ e Colours.ssymlink( 'Hello world (through ssymlink())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.ssymlink('').inspect
34
+ e Colours.scomments( 'Hello world (through scomments())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.scomments('').inspect
35
+ e
36
+ e "#{rev}Next we will use Colours.use_new_colour_table() and hope"
37
+ e "#{rev}that this will change the above colours."
38
+ Colours.use_new_colour_table
39
+ e
40
+ e "#{rev}Showing the new colour-table next:"
41
+ e
42
+ pp ::Colours.colour_table?
43
+ e
44
+ e Colours.sfancy( 'Hello world (through sfancy())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.sfancy('').inspect
45
+ e Colours.sdir( 'Hello world (through sdir())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.sdir('').inspect
46
+ e Colours.simportant('Hello world (through simportant())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.simportant('').inspect
47
+ e Colours.swarn( 'Hello world (through swarn())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.swarn('').inspect
48
+ # e Colours.snormal( 'Hello world (through snormal())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.snormal('').inspect
49
+ # e Colours.sargument( 'Hello world (through sargument())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.sargument('').inspect
50
+ e Colours.sfile( 'Hello world (through sfile())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.sfile('').inspect
51
+ e Colours.ssymlink( 'Hello world (through ssymlink())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.ssymlink('').inspect
52
+ e Colours.scomments( 'Hello world (through scomments())').ljust(PADDING_TO_USE)+" #{ARROW} "+Colours.scomments('').inspect
53
+ e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colours
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.12
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert A. Heiler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-29 00:00:00.000000000 Z
11
+ date: 2023-12-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2+
14
14
 
@@ -22,10 +22,9 @@ description: |2+
22
22
 
23
23
  For more information about this project, have a look at the online
24
24
  documentation for this gem at the link called "documentation", at
25
- the bottom right side of the colours
26
- gem homepage:
25
+ the bottom right side of the colours gem homepage:
27
26
 
28
- https://www.rubydoc.info/gems/colours/0.8.12
27
+ https://www.rubydoc.info/gems/colours/0.9.8
29
28
 
30
29
  email: shevy@inbox.lt
31
30
  executables: []
@@ -43,52 +42,46 @@ files:
43
42
  - bin/print_rainbow_line
44
43
  - bin/rainbow_colours
45
44
  - bin/remove_ansii_escape_sequences
45
+ - bin/show_basic_colour_palette
46
46
  - bin/steelblue
47
47
  - colours.gemspec
48
- - doc/COLOUR_CODES_CHART.md
49
- - doc/HOW_TO_PICK_YOUR_OWN_COLOURS.md
50
48
  - doc/README.gen
49
+ - doc/colour_codes_chart/colour_codes_chart.md
50
+ - doc/how_to_pick_your_own_colours/how_to_pick_your_own_colours.md
51
51
  - doc/todo/todo.md
52
52
  - lib/colours.rb
53
- - lib/colours/256_colours/support_for_256_colours.rb
54
53
  - lib/colours/autoalias_e.rb
54
+ - lib/colours/autogenerated/256_colours_instance_methods.rb
55
+ - lib/colours/autogenerated/256_colours_methods.rb
55
56
  - lib/colours/autogenerated/README.md
56
- - lib/colours/autogenerated/support_for_256_colours.rb
57
- - lib/colours/autogenerated/support_for_html_colours.rb
58
- - lib/colours/autogenerated/toplevel_basic_colour_methods.rb
57
+ - lib/colours/autogenerated/html_colours_instance_methods.rb
58
+ - lib/colours/autogenerated/html_colours_methods.rb
59
59
  - lib/colours/autoinclude.rb
60
60
  - lib/colours/base/base.rb
61
- - lib/colours/basic_colours/README.md
62
- - lib/colours/basic_colours/basic_colours.rb
63
61
  - lib/colours/class/colours.rb
64
- - lib/colours/colour_methods/README.md
65
- - lib/colours/colour_methods/colour_methods.rb
66
- - lib/colours/colour_table/README.md
67
- - lib/colours/colour_table/colour_table.rb
62
+ - lib/colours/colour/colour.rb
68
63
  - lib/colours/colours_e_autoinclude.rb
69
64
  - lib/colours/commandline/README.md
70
65
  - lib/colours/commandline/commandline.rb
71
- - lib/colours/commandline/menu.rb
72
66
  - lib/colours/constants/constants.rb
73
- - lib/colours/constants/escape.rb
74
- - lib/colours/constants/file_constants.rb
75
- - lib/colours/constants/hash_ansi_colours.rb
76
- - lib/colours/constants/hash_simple_colours.rb
77
- - lib/colours/constants/misc.rb
78
- - lib/colours/constants/newline.rb
79
- - lib/colours/constants/registered_colour_methods.rb
80
67
  - lib/colours/e.rb
81
68
  - lib/colours/e/README.md
82
69
  - lib/colours/e/autoinclude.rb
83
70
  - lib/colours/e/e.rb
84
71
  - lib/colours/eparse/eparse.rb
72
+ - lib/colours/essentials/README.md
73
+ - lib/colours/essentials/essentials.rb
85
74
  - lib/colours/everything/autoinclude.rb
75
+ - lib/colours/html_colours.rb
86
76
  - lib/colours/html_colours/README.md
87
- - lib/colours/html_colours/add_html_colours_onto_the_toplevel_namespace.rb
77
+ - lib/colours/html_colours/hash_html_colours.rb
88
78
  - lib/colours/html_colours/html_colours.rb
79
+ - lib/colours/html_colours/push_the_html_colours_methods_onto_the_toplevel_namespace.rb
80
+ - lib/colours/html_colours/random_html_colour.rb
89
81
  - lib/colours/kde_colour_palette/kde_colour_palette.rb
90
82
  - lib/colours/map_symbol_to_corresponding_colour/map_symbol_to_corresponding_colour.rb
91
83
  - lib/colours/module.rb
84
+ - lib/colours/module_256_colours/module_256_colours.rb
92
85
  - lib/colours/project/project.rb
93
86
  - lib/colours/rainbow_colours/README.md
94
87
  - lib/colours/rainbow_colours/check_for_trollop_being_available_or_exit.rb
@@ -102,14 +95,15 @@ files:
102
95
  - lib/colours/rainbow_colours/report_errors.rb
103
96
  - lib/colours/rainbow_colours/returnln_plain.rb
104
97
  - lib/colours/rainbow_colours/set_mode.rb
98
+ - lib/colours/replace_tokens_with_colour_code/replace_tokens_with_colour_code.rb
105
99
  - lib/colours/requires/require_autogenerated_colour_methods.rb
106
100
  - lib/colours/requires/require_commandline.rb
107
101
  - lib/colours/requires/require_eparse.rb
102
+ - lib/colours/requires/require_essentials.rb
108
103
  - lib/colours/requires/require_rgb.rb
104
+ - lib/colours/requires/require_save_file.rb
109
105
  - lib/colours/requires/require_the_256_colours_module.rb
110
- - lib/colours/requires/require_the_basic_colours.rb
111
106
  - lib/colours/requires/require_the_colour_methods.rb
112
- - lib/colours/requires/require_the_colour_table.rb
113
107
  - lib/colours/requires/require_the_constants.rb
114
108
  - lib/colours/requires/require_the_html_colours.rb
115
109
  - lib/colours/requires/require_the_kde_colour_palette.rb
@@ -117,34 +111,13 @@ files:
117
111
  - lib/colours/requires/require_the_toplevel_methods.rb
118
112
  - lib/colours/requires/require_yaml.rb
119
113
  - lib/colours/rgb/rgb.rb
114
+ - lib/colours/sfile_sdir_sfancy_swarn_simp_scomments_and_ssymlink/sfile_sdir_sfancy_swarn_simp_scomments_and_ssymlink.rb
120
115
  - lib/colours/testing/README.md
121
116
  - lib/colours/testing/testing.rb
122
- - lib/colours/toplevel_methods/autogenerate.rb
123
- - lib/colours/toplevel_methods/bold.rb
124
- - lib/colours/toplevel_methods/bold_and_italic.rb
125
- - lib/colours/toplevel_methods/cat.rb
126
- - lib/colours/toplevel_methods/clear_screen.rb
127
- - lib/colours/toplevel_methods/cliner.rb
128
- - lib/colours/toplevel_methods/col.rb
129
117
  - lib/colours/toplevel_methods/e.rb
130
- - lib/colours/toplevel_methods/esystem.rb
131
- - lib/colours/toplevel_methods/html_colour_to_hex_value.rb
132
- - lib/colours/toplevel_methods/html_colourize.rb
133
- - lib/colours/toplevel_methods/is_on_roebe.rb
134
- - lib/colours/toplevel_methods/italic.rb
135
- - lib/colours/toplevel_methods/make_colour.rb
136
- - lib/colours/toplevel_methods/methods_related_to_html_colours.rb
137
- - lib/colours/toplevel_methods/misc.rb
138
- - lib/colours/toplevel_methods/open_this_file.rb
139
- - lib/colours/toplevel_methods/prefer_this_colour_schemata.rb
140
- - lib/colours/toplevel_methods/random_value.rb
141
- - lib/colours/toplevel_methods/remove_escape_sequence.rb
142
- - lib/colours/toplevel_methods/revert.rb
143
- - lib/colours/toplevel_methods/set_last_colour_used.rb
144
- - lib/colours/toplevel_methods/shell_file_containing_the_html_colours.sh
145
- - lib/colours/toplevel_methods/show_basic_colour_palette.rb
146
- - lib/colours/toplevel_methods/underline.rb
147
- - lib/colours/toplevel_methods/use_colours.rb
118
+ - lib/colours/toplevel_methods/map_this_symbol_to_that_html_colour.rb
119
+ - lib/colours/toplevel_methods/rev.rb
120
+ - lib/colours/toplevel_methods/toplevel_methods.rb
148
121
  - lib/colours/version/version.rb
149
122
  - lib/colours/yaml/256_colours.yml
150
123
  - lib/colours/yaml/basic_colours.yml
@@ -167,7 +140,7 @@ files:
167
140
  - test/testing_replace_number_words_with_the_corresponding_html_colour.rb
168
141
  - test/testing_rgb_to_hex.rb
169
142
  - test/testing_the_basic_colours_of_the_colours_project.rb
170
- - test/testing_the_colour_methods.rb
143
+ - test/testing_the_colour_methods_such_as_simp_sdir_sfile_swarn_sfancy_sargument_and_ssymlink.rb
171
144
  - test/testing_the_constants_of_the_colours_project.rb
172
145
  - test/testing_the_ecomment_method.rb
173
146
  - test/testing_the_html_colours_of_the_colours_project.rb
@@ -209,9 +182,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
182
  requirements:
210
183
  - - ">="
211
184
  - !ruby/object:Gem::Version
212
- version: 3.4.18
185
+ version: 3.4.22
213
186
  requirements: []
214
- rubygems_version: 3.4.18
187
+ rubygems_version: 3.4.22
215
188
  signing_key:
216
189
  specification_version: 4
217
190
  summary: 'This library is called colours. It unifies colour-related constants and
@@ -220,6 +193,6 @@ summary: 'This library is called colours. It unifies colour-related constants an
220
193
  is to make commandline-scripts display text on the terminal with colours. For more
221
194
  information about this project, have a look at the online documentation for this
222
195
  gem at the link called "documentation", at the bottom right side of the colours
223
- gem homepage: https://www.rubydoc.info/gems/colours/0.8.12'
196
+ gem homepage: https://www.rubydoc.info/gems/colours/0.9.8'
224
197
  test_files: []
225
198
  ...
@@ -1,28 +0,0 @@
1
- This file describes how to pick your own colours - or how to use
2
- the Colours gem.
3
-
4
- The colours-centric Hash will contain entries such as:
5
-
6
- sdir: :olivedrab
7
-
8
- Now, what does this mean?
9
-
10
- This is a hash entry, a key->value pair, with the key being called
11
- :sdir, and the value being :olivedrab.
12
-
13
- "sdir" is an abbreviation for "string_dir", aka "string_directory".
14
-
15
- :olivedrab is the HTML colour called olivedrab, a beige-green variant.
16
-
17
- What this thus does means, in english, is to "use the colour olivedrab
18
- in order to display directories in a coloured fashion".
19
-
20
- If you wish to use another colour, simply change the Symbol on the
21
- right hand side, aka :olivedrab, to another name, such as :steelblue
22
- or :orange. The names that should be chosen here are HTML Colour
23
- names.
24
-
25
- If you wish to get an overview of all available HTML colours, in ruby
26
- code, you can do this via the Colours namespace:
27
-
28
- Colours.show_html_colours
@@ -1,196 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # Encoding: UTF-8
3
- # frozen_string_literal: true
4
- # =========================================================================== #
5
- # require 'colours/256_colours/support_for_256_colours.rb'
6
- # =========================================================================== #
7
- module Colours
8
-
9
- require 'yaml'
10
- require 'colours/constants/misc.rb'
11
- require 'colours/constants/newline.rb'
12
- require 'colours/constants/file_constants.rb'
13
- require 'colours/toplevel_methods/revert.rb'
14
-
15
- # ========================================================================= #
16
- # === @dataset_for_the_256_colours
17
- #
18
- # We will keep the keys in a downcased variant, as this will make it
19
- # easier to use them as method-names.
20
- # ========================================================================= #
21
- if File.exist?(FILE_256_COLOURS) # Must safeguard.
22
- @dataset_for_the_256_colours = YAML.load_file(FILE_256_COLOURS).
23
- transform_keys(&:downcase)
24
- else
25
- @dataset_for_the_256_colours = nil
26
- end
27
-
28
- # ========================================================================= #
29
- # === Colours.return_this_256_colour
30
- #
31
- # The first argument to this method should be a number from 0 to 255.
32
- #
33
- # For example, 255 is also known as "Grey93" - a variant of grey.
34
- #
35
- # It appears to work better if you use print() rather than puts() for
36
- # whatever is returned here - perhaps due to the leading \u001b part.
37
- #
38
- # You can also input the colour variant, such as 'Grey93'.
39
- #
40
- # Invocation example:
41
- #
42
- # Colours.return_this_256_colour(255, "Hello world in grey!\n")
43
- # print Colours.return_this_256_colour(255, (Roebe.block_character*5)+" Hello world in grey! "+(Roebe.block_character*5)+" \n")
44
- # print Colours.return_this_256_colour('DarkTurquoise', (Roebe.block_character*5)+" Hello world in DarkTurquoise! "+(Roebe.block_character*5)+" \n")
45
- #
46
- # ========================================================================= #
47
- def self.return_this_256_colour(
48
- id = 9,
49
- use_this_text = "Hello world!"
50
- )
51
- id = id.to_s.downcase
52
- if (id !~ /^\d+/) and @dataset_for_the_256_colours and
53
- @dataset_for_the_256_colours.has_key?(id)
54
- id = @dataset_for_the_256_colours[id]
55
- end
56
- "\u001b[38;5;#{id}m#{use_this_text}#{REVERT}"
57
- end
58
-
59
- # ========================================================================= #
60
- # === Colours.write_this_in_256_colours
61
- #
62
- # Similar to the other write method, but has the arguments reversed.
63
- # ========================================================================= #
64
- def self.write_this_in_256_colours(
65
- this_text = "Hello world!\n",
66
- id = rand(256),
67
- &block
68
- )
69
- display_this_256_colour(id, this_text, &block)
70
- end; self.instance_eval { alias write_in_256_colour write_this_in_256_colours } # === Colours.write_in_256_colour
71
-
72
- # ========================================================================= #
73
- # === write_in_256_colour
74
- #
75
- # Include-able method to the above module-level instance.
76
- # ========================================================================= #
77
- def write_in_256_colour(
78
- i = 'hi there',
79
- id = 33
80
- )
81
- write_this_in_256_colours(i, id)
82
- end
83
-
84
- # ========================================================================= #
85
- # === Colours.display_this_256_colour
86
- #
87
- # The first argument should be a number from 0 to 255.
88
- #
89
- # You can also batch-output all colours, by using something like:
90
- #
91
- # Colours.display_this_256_colour('0-255',"Hello world, in a batch!\n")
92
- #
93
- # Generic usage example:
94
- #
95
- # Colours.display_this_256_colour(33, 'yo there') { :newline }
96
- #
97
- # ========================================================================= #
98
- def self.display_this_256_colour(
99
- id = 9,
100
- use_this_text = "Hello world!\n",
101
- &block
102
- )
103
- if block_given?
104
- yielded = yield
105
- case yielded
106
- when :newline
107
- use_this_text = use_this_text.dup if use_this_text.frozen?
108
- use_this_text << "\n"
109
- end
110
- end
111
- if id.is_a?(String) and id.include?('-')
112
- # ===================================================================== #
113
- # Assume pseudo-range input.
114
- # ===================================================================== #
115
- splitted = id.split('-')
116
- range = (splitted.first.to_i .. splitted.last.to_i).to_a
117
- range.each {|this_range_id|
118
- display_this_256_colour(this_range_id, use_this_text, &block)
119
- }
120
- else
121
- print return_this_256_colour(id, use_this_text)
122
- end
123
- end; self.instance_eval { alias display_this_in_256_colour display_this_256_colour } # === Colours.display_this_in_256_colour
124
-
125
- # ========================================================================= #
126
- # === Colours.show_all_256_colours
127
- # ========================================================================= #
128
- def self.show_all_256_colours
129
- yielded = nil
130
- if block_given?
131
- yielded = yield
132
- end
133
- 0.upto(255).each {|this_number|
134
- result = this_number.to_s.rjust(4)+' '+
135
- return_this_256_colour(this_number).to_s.dup
136
- if yielded and yielded == :newline
137
- result << "\n"
138
- end
139
- print result
140
- }
141
- end
142
-
143
- # ========================================================================= #
144
- # === Colours.show_256_colour_cube
145
- #
146
- # This will show the 256-colours cube. Colours 16-231 are a
147
- # 6x6x6 color cube.
148
- # ========================================================================= #
149
- def self.show_256_colour_cube
150
- puts 'Color cube, 6x6x6 blocks:'
151
- 0.upto(5) {|green|
152
- 0.upto(5) {|red|
153
- 0.upto(5) {|blue|
154
- colour = 16 + (red * 36) + (green * 6) + blue
155
- print "\x1b[48;5;#{colour}m "
156
- }
157
- print "\x1b[0m "
158
- }
159
- puts
160
- }
161
- end
162
-
163
- # ========================================================================= #
164
- # === Colours.is_this_a_256_colour?
165
- #
166
- # Invocation example:
167
- #
168
- # Colours.is_this_a_256_colour? 'LightSteelBlue3'
169
- #
170
- # ========================================================================= #
171
- def self.is_this_a_256_colour?(i)
172
- if @dataset_for_the_256_colours
173
- @dataset_for_the_256_colours.keys.map(&:downcase).include?(i.to_s.downcase)
174
- else
175
- false
176
- end
177
- end
178
-
179
- # ========================================================================= #
180
- # === is_this_a_256_colour?
181
- # ========================================================================= #
182
- def is_this_a_256_colour?(i)
183
- ::Colours.is_this_a_256_colour?(i)
184
- end
185
-
186
- end
187
-
188
- if __FILE__ == $PROGRAM_NAME
189
- alias e puts
190
- Colours.show_256_colour_cube
191
- # The next line can be found in: colours/test/testing_256_colours_support.rb
192
- # Colours.test_256_colours_support
193
- e
194
- Colours.display_this_256_colour('0-255',"Hello world, in a batch!\n")
195
- e
196
- end # supportfor256colours