text_shade 1.0.1 → 2.0.0

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -0
  3. data/doc/_index.html +107 -0
  4. data/lib/text_shade.rb +105 -25
  5. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cf0025996214e03b615e4e21aafccba08869939f68aab183f6e9bed452362fe
4
- data.tar.gz: be94ab966621196a34be9dd6b88a49a2079f0e6c5cb7aa4107d2581acd844714
3
+ metadata.gz: 007e16e12196837b45b496499443d6bde9ca5617a79de7584c59c78b41fe4b30
4
+ data.tar.gz: 9300b887d9e285853021eeb471b9205ed9ae74a5ac9da4a1293244ab8bcb524a
5
5
  SHA512:
6
- metadata.gz: eeb2111c9df44901d75fd844cd7ccb7370125e0474cf729be10b89b0e8e66e04fc8947efaa6241eb5b536afa6e7e588b4c65b260a48e01a27b38a3009210067c
7
- data.tar.gz: 525d3c7e4d7bd7fe2b77102a94475721a6b201f9453ddc6ed39e84d6bb5969b0ab76dd450324427bb0bd965ad3e7142e97eb2094151e954d8f1272498f58950b
6
+ metadata.gz: f46b9635053adb6a0a018dd262ff95584c1c57ceb4ca92145f7a7de8d77164f1f2e2f928ec12351bc1aca43d7364fc7174bdeed39021d07941d80de5065d2a64
7
+ data.tar.gz: 98ace9fa541d8b8c25ae148eba1fee53b5cdc51bb6376acbcd17aa739c9a06ac9f33d1fb26387087e8ebd3b49aa42492d7fd3199e38de8ea0cb79a35622e5439
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ ## TextShade
2
+ Text Shade is a gem to colour our your string text. It can be used to print text in these colors.
3
+ - black
4
+ - red
5
+ - green
6
+ - yellow
7
+ - blue
8
+ - magenta
9
+ - cyan
10
+ - light_gray
11
+ - light_red
12
+ - light_green
13
+ - light_yellow
14
+ - light_blue
15
+ - light_magenta
16
+ - light_cyan
17
+
18
+ To print any string in a specified color, do
19
+ "any string".<any-of-colors-above>
20
+ eg.
21
+ for red: "string".red
22
+
23
+ ## Usage
24
+
25
+ Require this Gem:
26
+ require 'text_shade'
27
+
28
+ ## Limitation
29
+
30
+ This may not work on windows systems.
data/doc/_index.html ADDED
@@ -0,0 +1,107 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Documentation by YARD 0.9.26
8
+
9
+ </title>
10
+
11
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
12
+
13
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
14
+
15
+ <script type="text/javascript">
16
+ pathId = null;
17
+ relpath = '';
18
+ </script>
19
+
20
+
21
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
24
+
25
+
26
+ </head>
27
+ <body>
28
+ <div class="nav_wrap">
29
+ <iframe id="nav" src="class_list.html?1"></iframe>
30
+ <div id="resizer"></div>
31
+ </div>
32
+
33
+ <div id="main" tabindex="-1">
34
+ <div id="header">
35
+ <div id="menu">
36
+
37
+ </div>
38
+
39
+ <div id="search">
40
+
41
+ <a class="full_list_link" id="class_list_link"
42
+ href="class_list.html">
43
+
44
+ <svg width="24" height="24">
45
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
46
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
47
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
48
+ </svg>
49
+ </a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <div id="content"><h1 class="noborder title">Documentation by YARD 0.9.26</h1>
56
+ <div id="listing">
57
+ <h1 class="alphaindex">Alphabetic Index</h1>
58
+
59
+ <h2>File Listing</h2>
60
+ <ul id="files" class="index_inline_list">
61
+
62
+
63
+ <li class="r1"><a href="index.html" title="README">README</a></li>
64
+
65
+
66
+ </ul>
67
+
68
+ <div class="clear"></div>
69
+ <h2>Namespace Listing A-Z</h2>
70
+
71
+
72
+
73
+
74
+ <table>
75
+ <tr>
76
+ <td valign='top' width="33%">
77
+
78
+
79
+ <ul id="alpha_S" class="alpha">
80
+ <li class="letter">S</li>
81
+ <ul>
82
+
83
+ <li>
84
+ <span class='object_link'><a href="String.html" title="String (class)">String</a></span>
85
+
86
+ </li>
87
+
88
+ </ul>
89
+ </ul>
90
+
91
+ </td>
92
+ </tr>
93
+ </table>
94
+
95
+ </div>
96
+
97
+ </div>
98
+
99
+ <div id="footer">
100
+ Generated on Tue Apr 27 20:39:40 2021 by
101
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
102
+ 0.9.26 (ruby-3.0.0).
103
+ </div>
104
+
105
+ </div>
106
+ </body>
107
+ </html>
data/lib/text_shade.rb CHANGED
@@ -1,27 +1,107 @@
1
- class TextShade
2
-
3
- def self.shade(text, color)
4
- puts "\e[#{code(color)}m#{text}\e[0m"
5
- end
6
-
7
- def self.code(color)
8
- color_code = {
9
- black: 30,
10
- red: 31,
11
- green: 32,
12
- yellow: 33,
13
- blue: 34,
14
- magenta: 35,
15
- cyan: 36,
16
- light_gray: 37,
17
- dark_gray: 90,
18
- light_red: 91,
19
- light_green: 92,
20
- light_yellow: 93,
21
- light_blue: 94,
22
- light_magenta: 95,
23
- light_cyan: 96,
24
- }
25
- color_code[color.to_sym]
1
+ class String
2
+ # apply color to string object
3
+ # @param request [Request] the request object
4
+ # @param integer [integer]
5
+ # @return [string] converted
6
+ def shade(code)
7
+ puts "\e[#{code}m#{self}\e[0m"
8
+ end
9
+
10
+ # color black method defined on string object
11
+ # @param request [Request] the request object
12
+ # @return [String] in black color
13
+ def black
14
+ shade(30)
15
+ end
16
+
17
+ # color red method defined on string object
18
+ # @param request [Request] the request object
19
+ # @return [String] in red color
20
+ def red
21
+ shade(31)
22
+ end
23
+
24
+ # color green method defined on string object
25
+ # @param request [Request] the request object
26
+ # @return [String] in green color
27
+ def green
28
+ shade(32)
29
+ end
30
+
31
+ # color yellow method defined on string object
32
+ # @param request [Request] the request object
33
+ # @return [String] in yellow color
34
+ def yellow
35
+ shade(33)
36
+ end
37
+
38
+ # color blue method defined on string object
39
+ # @param request [Request] the request object
40
+ # @return [String] in blue color
41
+ def blue
42
+ shade(34)
43
+ end
44
+
45
+ # color magenta method defined on string object
46
+ # @param request [Request] the request object
47
+ # @return [String] in magenta color
48
+ def magenta
49
+ shade(35)
50
+ end
51
+
52
+ # color cyan method defined on string object
53
+ # @param request [Request] the request object
54
+ # @return [String] in cyan color
55
+ def cyan
56
+ shade(36)
57
+ end
58
+
59
+ # color light gray method defined on string object
60
+ # @param request [Request] the request object
61
+ # @return [String] in light gray color
62
+ def light_gray
63
+ shade(37)
64
+ end
65
+
66
+ # color light red method defined on string object
67
+ # @param request [Request] the request object
68
+ # @return [String] in light red color
69
+ def light_red
70
+ shade(91)
71
+ end
72
+
73
+ # color light green method defined on string object
74
+ # @param request [Request] the request object
75
+ # @return [String] in light green color
76
+ def light_green
77
+ shade(92)
78
+ end
79
+
80
+ # color light yellow method defined on string object
81
+ # @param request [Request] the request object
82
+ # @return [String] in light yellow color
83
+ def light_yellow
84
+ shade(93)
85
+ end
86
+
87
+ # color light blue method defined on string object
88
+ # @param request [Request] the request object
89
+ # @return [String] in light blue color
90
+ def light_blue
91
+ shade(94)
92
+ end
93
+
94
+ # color light magenta method defined on string object
95
+ # @param request [Request] the request object
96
+ # @return [String] in light magenta color
97
+ def light_magenta
98
+ shade(95)
99
+ end
100
+
101
+ # color light cyan method defined on string object
102
+ # @param request [Request] the request object
103
+ # @return [String] in light cyan color
104
+ def light_cyan
105
+ shade(96)
26
106
  end
27
107
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text_shade
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amit Kumar
@@ -14,8 +14,12 @@ description: A gem to color out text
14
14
  email: amitkumar301293@gmail.com
15
15
  executables: []
16
16
  extensions: []
17
- extra_rdoc_files: []
17
+ extra_rdoc_files:
18
+ - README.md
19
+ - doc/_index.html
18
20
  files:
21
+ - README.md
22
+ - doc/_index.html
19
23
  - lib/text_shade.rb
20
24
  homepage: https://rubygems.org/gems/text_shade
21
25
  licenses: