nixcolor 0.0.1 → 0.0.2

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 (2) hide show
  1. data/lib/nixcolor.rb +17 -4
  2. metadata +3 -3
@@ -1,31 +1,44 @@
1
1
  class NixColor
2
-
2
+ ##
3
+ # Generate rgb colors
3
4
  def self.rgb(red, green, blue)
4
5
  16 + (red * 36) + (green * 6) + blue
5
6
  end
6
7
 
8
+ ##
9
+ # set background to color
7
10
  def self.bg color
8
11
  "\x1b[48;5;#{color}m"
9
12
  end
10
13
 
14
+ ##
15
+ # set foreground to color
11
16
  def self.fg color
12
- "\x1b[48;5;#{color}m"
17
+ "\x1b[38;5;#{color}m"
13
18
  end
14
19
 
20
+ ##
21
+ # lazy background "shortcut"
15
22
  def self.background color
16
23
  self.bg color
17
24
  end
18
25
 
26
+ ##
27
+ # lazy foreground "shortcut"
19
28
  def self.foreground color
20
29
  self.fg color
21
30
  end
22
31
 
32
+ ##
33
+ # Clear terminal from colors
23
34
  def self.clear_color
24
- "\x1b[0m" # Clear Colors
35
+ "\x1b[0m"
25
36
  end
26
37
 
38
+ ##
39
+ # Clear screen and reset cursor
27
40
  def self.clear
28
- "\e[2J\e[1;1H" # Clear Screen, return Cursor
41
+ "\e[2J\e[1;1H"
29
42
  end
30
43
 
31
44
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nixcolor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roman Pramberger