corol 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/corol.rb +46 -136
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54b6ee3c49292fc487e58a05d2523c8da4b448f1
4
- data.tar.gz: fddddba8413baf33ec962442e6b39213d33b7e68
3
+ metadata.gz: 3578120dbd755f65b382746932690e5b291d9cfe
4
+ data.tar.gz: 86e57b591989c420d82f59e8636f43eed20eff66
5
5
  SHA512:
6
- metadata.gz: 7f349c883ef2214cf7fac8771ac6d2c037cf76867b0b4eaf91cd60a4c67f48140fd90b7d1d3eb40a320e9f7783b4d7fae43dc6ed0816235329f800a8d9649645
7
- data.tar.gz: 971a59a5a80e6e4cea524f573fbd54177559927fc43a9c496c79652b5185caf163294fa2076eb4421e74634d8d1908db8bb9e4f727db6d0e0004576646e784b7
6
+ metadata.gz: 79ae21f34851b5a84e4f15bdf8e817f3e8d20adf51776f7fdb4fedba65321c491ecd67df4ee44e69199020941269535b14da089abde1b713d8a8eb8bb4ae1fac
7
+ data.tar.gz: 94a9a6dcb56122bf7e58c5bb85e366f482fd8f79041b4620d092209f27aa1d8c7fb8dd8ce754c99dcab6e3ee5c0322c41206704d1d02e04333d531c72f40ef5c
@@ -1,139 +1,49 @@
1
- #### Text Colors Codes ####
2
- RED = "\e[31m" #Variable and Color code for red
3
- WHITE = "\e[0m" #Variable and Color code for white and resetting color or format
4
- BLACK = "\e[30m" #Variable and Color code for black
5
- GREEN = "\e[32m" #Variable and Color code for green
6
- YELLOW = "\e[33m" #Variable and Color code for yellow
7
- BLUE = "\e[34m" #Variable and Color code for blue
8
- MAGENTA = "\e[35m" #Variable and Color code for magenta
9
- CYAN = "\e[36m" #Variable and Color code for cyan
10
- LIGHT_RED = "\e[91m" #Variable and Color code for light red
11
- LIGHT_GREEN = "\e[92m" #Variable and Color code for light green
12
- LIGHT_YELLOW = "\e[93m" #Variable and Color code for light yellow
13
- LIGHT_BLUE = "\e[94m" #Variable and Color code for light blue
14
- LIGHT_MAGENTA = "\e[95m" #Variable and Color code for light magenta
15
- LIGHT_CYAN = "\e[96m" #Variable and Color code for light cyan
16
-
17
- #### BackGround Colors Codes ####
18
- BACK_RED = "\e[41m" #Variable and Color code for Background red
19
- BACK_GREEN = "\e[42m" #Variable and Color code for Background green
20
- BACK_YELLOW = "\e[43m" #Variable and Color code for Background yellow
21
- BACK_BLUE = "\e[44m" #Variable and Color code for Background blue
22
- BACK_MAGENTA = "\e[45m" #Variable and Color code for Background magenta
23
- BACK_CYAN = "\e[46m" #Variable and Color code for Background cyan
24
- BACK_LIG_RED = "\e[101m" #Variable and Color code for Background light red
25
- BACK_LIG_GREEN = "\e[102m" #Variable and Color code for Background light green
26
- BACK_LIG_YELLOW = "\e[103m" #Variable and Color code for Background light yellow
27
- BACK_LIG_BLUE = "\e[104m" #Variable and Color code for Background light blue
28
- BACK_LIG_MAGENTA = "\e[105m" #Variable and Color code for Background light magenta
29
- BACK_LIG_CYAN = "\e[106m" #Variable and Color code for Background light cyan
30
-
31
-
32
-
33
- #### Formatting Codes ####
34
- BOLD = "\e[1m" #Variable and code for bold
35
- DIM = "\e[2m" #Variable and code for dim
36
- UND_LINE = "\e[4m" #Variable and code for underline
37
- HIDDEN = "\e[8m" #Variable and code for hidden text . For passwords
38
-
39
-
40
- module Colors
41
- def red
42
- return RED+"#{self}"+WHITE
43
- end
44
- def white
45
- return WHITE+"#{self}"+WHITE
46
- end
47
- def black
48
- return BLACK+"#{self}"+WHITE
49
- end
50
- def green
51
- return GREEN+"#{self}"+WHITE
52
- end
53
- def yellow
54
- return YELLOW+"#{self}"+WHITE
55
- end
56
- def blue
57
- return BLUE+"#{self}"+WHITE
58
- end
59
- def magenta
60
- return MAGENTA+"#{self}"+WHITE
61
- end
62
- def cyan
63
- return CYAN+"#{self}"+WHITE
64
- end
65
- def light_red
66
- return LIGHT_RED+"#{self}"+WHITE
67
- end
68
- def light_green
69
- return LIGHT_GREEN+"#{self}"+WHITE
70
- end
71
- def light_yellow
72
- return LIGHT_YELLOW+"#{self}"+WHITE
73
- end
74
- def light_blue
75
- return LIGHT_BLUE+"#{self}"+WHITE
76
- end
77
- def light_magenta
78
- return LIGHT_MAGENTA+"#{self}"+WHITE
79
- end
80
- def light_cyan
81
- return LIGHT_CYAN+"#{self}"+WHITE
82
- end
83
- end
84
-
85
- module BG_Colors
86
- def back_red
87
- return BACK_RED+"#{self}"+WHITE
88
- end
89
- def back_green
90
- return BACK_GREEN+"#{self}"+WHITE
91
- end
92
- def back_yellow
93
- return BACK_YELLOW+"#{self}"+WHITE
94
- end
95
- def back_blue
96
- return BACK_BLUE+"#{self}"+WHITE
97
- end
98
- def back_magenta
99
- return BACK_MAGENTA+"#{self}"+WHITE
100
- end
101
- def back_cyan
102
- return BACK_CYAN+"#{self}"+WHITE
103
- end
104
- def back_light_red
105
- return BACK_LIG_RED+"#{self}"+WHITE
106
- end
107
- def back_light_green
108
- return BACK_LIG_GREEN+"#{self}"+WHITE
109
- end
110
- def back_light_yellow
111
- return BACK_LIG_YELLOW+"#{self}"+WHITE
112
- end
113
- def back_light_blue
114
- return BACK_BLUE+"#{self}"+WHITE
115
- end
116
- def back_light_magenta
117
- return BACK_LIG_MAGENTA+"#{self}"+WHITE
118
- end
119
- def back_light_cyan
120
- return BACK_LIG_CYAN+"#{self}"+WHITE
121
- end
122
- end
123
-
124
- module Formatting
125
- def bold
126
- return BOLD+"#{self}"+WHITE
127
- end
128
- def dim
129
- return DIM+"#{self}"+WHITE
130
- end
131
- def und_line
132
- return UND_LINE+"#{self}"+WHITE
133
- end
134
- def hidden
135
- return HIDDEN+"#{self}"+WHITE
1
+ module Corol
2
+ colors = {
3
+ RED:"\e[31m",
4
+ WHITE:"\e[0m",
5
+ BLACK:"\e[30m",
6
+ GREEN:"\e[32m",
7
+ YELLOW:"\e[33m",
8
+ BLUE:"\e[34m",
9
+ MAGENTA:"\e[35m",
10
+ CYAN:"\e[36m",
11
+ LIGHT_RED:"\e[91m",
12
+ LIGHT_GREEN:"\e[92m",
13
+ LIGHT_YELLOW:"\e[93m",
14
+ LIGHT_BLUE:"\e[94m",
15
+ LIGHT_MAGENTA:"\e[95m",
16
+ LIGHT_CYAN:"\e[96m"
17
+ }
18
+ back_colors = {
19
+ BACK_RED:"\e[41m",
20
+ BACK_GREEN:"\e[42m",
21
+ BACK_YELLOW:"\e[43m",
22
+ BACK_BLUE:"\e[44m",
23
+ BACK_MAGENTA:"\e[45m",
24
+ BACK_CYAN:"\e[46m",
25
+ BACK_LIGHT_RED:"\e[101m",
26
+ BACK_LIGHT_GREEN:"\e[102m",
27
+ BACK_LIGHT_YELLOW:"\e[103m",
28
+ BACK_LIGHT_BLUE:"\e[104m",
29
+ BACK_LIGHT_MAGENTA:"\e[105m",
30
+ BACK_LIGHT_CYAN:"\e[106m"
31
+ }
32
+ formatting = {
33
+ BOLD:"\e[1m",
34
+ DIM:"\e[2m",
35
+ UND_LINE:"\e[4m",
36
+ HIDDEN:"\e[8m"
37
+ }
38
+ arr = [colors,back_colors,formatting]
39
+
40
+ arr.size.times do |l|
41
+ arr[l].keys.size.times do |i|
42
+ define_method(arr[l].keys[i].downcase) do
43
+ return arr[l].values[i]+"#{self}"+"\e[0m"
44
+ end
45
+ end
136
46
  end
137
47
  end
138
- class String ; include Colors, BG_Colors,Formatting ; end # include modules to using as instance methods
139
48
 
49
+ class String ; include Corol ; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Farhad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-19 00:00:00.000000000 Z
11
+ date: 2017-05-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: farhad9801@gmail.com