kolorit 0.1.3
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.
- checksums.yaml +7 -0
- data/lib/kolorit/linux.rb +52 -0
- data/lib/kolorit/version.rb +6 -0
- data/lib/kolorit.rb +19 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ef040c50bebe6a3d79fcaee8de83f9bd97233b9e432d6a232db7137beff88643
|
4
|
+
data.tar.gz: c262eabd58497efbfa76e72d918c1b2a6445c2a7dec772a0cbd67c97722d5b86
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0dac1ce53413bc676b2d03a0d3be3b8b27129ab02f2137dca9112e9ded142d184c320912b7560fd59b377564d3edcf95131ae3b6e372e6b001a3f2b493d45806
|
7
|
+
data.tar.gz: 63cd157d5400ac32f2eeca5e0b7af678175f5f3e94dc464175b8269ed1ecde08d9632ec52e5023e89e2096005dad35b05c6a62a92baf2d2455445595d5758443
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kolorit
|
4
|
+
module Linux
|
5
|
+
def black = colorize(30)
|
6
|
+
|
7
|
+
def red = colorize(31)
|
8
|
+
|
9
|
+
def green = colorize(32)
|
10
|
+
|
11
|
+
def yellow = colorize(33)
|
12
|
+
|
13
|
+
def blue = colorize(34)
|
14
|
+
|
15
|
+
def pink = colorize(35)
|
16
|
+
|
17
|
+
def cyan = colorize(36)
|
18
|
+
|
19
|
+
def gray = colorize(37)
|
20
|
+
|
21
|
+
def bold = colorize(1)
|
22
|
+
|
23
|
+
def italic = colorize(3)
|
24
|
+
|
25
|
+
def underline = colorize(4)
|
26
|
+
|
27
|
+
def blink = colorize(5)
|
28
|
+
|
29
|
+
def reverse_color = colorize(7)
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
##
|
34
|
+
# colorize string based on color_code
|
35
|
+
#
|
36
|
+
def colorize(color_code)
|
37
|
+
# check if we change color or type
|
38
|
+
type = case color_code
|
39
|
+
# for type-change
|
40
|
+
when 1 then 22 # bold
|
41
|
+
when 3 then 23 # italic
|
42
|
+
when 4 then 24 # underline
|
43
|
+
when 5 then 25 # blink
|
44
|
+
when 7 then 27 # reverse_color
|
45
|
+
# for color change
|
46
|
+
else 0
|
47
|
+
end
|
48
|
+
# create colorized string
|
49
|
+
"\e[#{color_code}m#{self}\e[#{type}m"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/kolorit.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'kolorit/version'
|
4
|
+
|
5
|
+
module Kolorit
|
6
|
+
end
|
7
|
+
|
8
|
+
if ENV['OS'] == 'Windows_NT'
|
9
|
+
# require_relative 'kolorit/windows'
|
10
|
+
class String
|
11
|
+
# working on windows color codes
|
12
|
+
# include Kolorit::Windows unless RUBY_PLATFORM =~ /cygwin/
|
13
|
+
end
|
14
|
+
else
|
15
|
+
require_relative 'kolorit/linux'
|
16
|
+
class String
|
17
|
+
include Kolorit::Linux
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kolorit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- alx3dev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |
|
14
|
+
Print your terminal output in different colors. Early development stage,
|
15
|
+
for now only Linux and Mac. MIT license.'
|
16
|
+
email:
|
17
|
+
- alx3dev@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- lib/kolorit.rb
|
23
|
+
- lib/kolorit/linux.rb
|
24
|
+
- lib/kolorit/version.rb
|
25
|
+
homepage: https://www.github.com/alx3dev/kolorit
|
26
|
+
licenses:
|
27
|
+
- MIT
|
28
|
+
metadata:
|
29
|
+
rubygems_mfa_required: 'true'
|
30
|
+
homepage_uri: https://www.github.com/alx3dev/kolorit
|
31
|
+
source_code_uri: https://www.github.com/alx3dev/kolorit
|
32
|
+
changelog_uri: https://www.github.com/alx3dev/kolorit/CHANGELOG.md
|
33
|
+
documentation_uri: https://rubydoc.info/gems/kolorit
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.6.0
|
43
|
+
- - "<"
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 4.0.0
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubygems_version: 3.2.32
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Colorize terminal output. Linux-Mac only, Windows CLI coming soon.
|
56
|
+
test_files: []
|