artsy 0.1.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 +7 -0
  2. data/lib/artsy.rb +49 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e36f8972ca13ddf1717d6a715a0bb2f6a53394f5c1c74366a6de39f52becc640
4
+ data.tar.gz: ed102c08091538dc5393c2f26c504c03c3733a0c533fdabc8013c4ec7d7df7bc
5
+ SHA512:
6
+ metadata.gz: 132c65d1b7f53b342b2ce2cf32a1405f0fe0c1be5f43356352c91e9fd883824e39e80eb2c68002ebc6f8f7cc54555f467065116f695ed59fce9b9726f9bdca70
7
+ data.tar.gz: 51d37b4dd0b392425f4eeb3f2ed30b688dcfe97fd86878f8da3cca65dc263b3195fceef075fe5230d4fe0ea2434c51341e2e26629d0f2b371d4294f39232856a
data/lib/artsy.rb ADDED
@@ -0,0 +1,49 @@
1
+ #################################################################
2
+ ### artsy.rb ###
3
+ #################################################################
4
+ ### Make your Ruby terminal programs look nice! ###
5
+ ### Developed by Brett (https://github.com/notronaldmcdonald) ###
6
+ #################################################################
7
+
8
+ class Artsy
9
+ # main class
10
+ def self.out(text, colortype, r = 0, g = 0, b = 0, color: "none", formatting: "none")
11
+ definedColours = ["\033[0m", "\033[31m", "\033[32m", "\033[93m", "\033[91m", "\033[92m", "\033[96m"]
12
+ # print colored/formatted text (either from the preset list or with truecolors)
13
+ # you MUST specify if you're printing truecolor or not
14
+ if colortype == "normal"
15
+ # print with regular colors
16
+ if color == "none"
17
+ # fail if color undefined
18
+ raise StandardError.new "Invalid color defined (#{color})."
19
+ elsif color == "red"
20
+ # printcolor = red
21
+ printcolor = "#{definedColours[1]}"
22
+ elsif color == "green"
23
+ printcolor = "#{definedColours[2]}"
24
+ elsif color == "yellow"
25
+ printcolor = "#{definedColours[3]}"
26
+ elsif color == "failureRed"
27
+ printcolor = "#{definedColours[4]}"
28
+ elsif color == "successGreen"
29
+ printcolor = "#{definedColours[5]}"
30
+ elsif color == "cyan"
31
+ printcolor = "#{definedColours[6]}"
32
+ else
33
+ # fail
34
+ raise StandardError.new "Invalid color defined (#{color})."
35
+ end
36
+ elsif colortype == "true"
37
+ # print with rgb
38
+ printcolor = "\033[38;2;#{r};#{g};#{b}m"
39
+ else
40
+ # fail
41
+ raise StandardError.new "Invalid colortype defined (#{colortype})."
42
+ end
43
+ if formatting == "none"
44
+ puts "#{printcolor}#{text}#{definedColours[0]}" # done!
45
+ elsif formatting == "bold"
46
+ puts "#{printcolor}\033[1m#{text}#{definedColours[0]}"
47
+ end
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: artsy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-05-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Enables you to make good looking terminal programs with colors and text
14
+ formatting.
15
+ email: mcdonalds.burger.dev@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/artsy.rb
21
+ homepage: https://github.com/notronaldmcdonald/artsy
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.2.14
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Prettier Ruby programs!
44
+ test_files: []