string_dot_gradient 0.1.8 → 0.1.9
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 +4 -4
- data/lib/string_dot_gradient/gradient.rb +11 -2
- data/lib/string_dot_gradient/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 229c7c52d938962d064671617bd9c8ae622df4a52fa5dd7df0b4485ec14e55a1
|
4
|
+
data.tar.gz: 0d926f9ed11056c3870c3964a7497c345b890582e8816296baa2c38eaa07836d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9baf8ae5b7a5e0285db981cc3d4426493cd44864f40a44cbefecde30b7742602f5424275bfe676a330dd9a8eb5c9117c4c50b055811c76d072c2f9c632ab7e07
|
7
|
+
data.tar.gz: 3186f138e9036fc98801a0810913524c16508a2468126c41a9482d3043b0accaf41bbcbf9aa2c6600365e30d043e6b311aaec8db6b43d83eea6cfe3e75f47565
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class String
|
2
2
|
##
|
3
|
-
# = gradient(*arg_colours, bg: false, exclude_spaces: true) # => string or nil
|
3
|
+
# = gradient(*arg_colours, bg: false, exclude_spaces: true, bold: false, blink: false) # => string or nil
|
4
4
|
#
|
5
5
|
# Prettifies your string by adding gradient colours.
|
6
6
|
#
|
@@ -40,7 +40,13 @@ class String
|
|
40
40
|
# This is because \r wipes out the previous characters, and using \u0000 in
|
41
41
|
# a string is uncommon, and developers are requested to delete
|
42
42
|
# \u0000 from string if such situations arise.
|
43
|
-
|
43
|
+
#
|
44
|
+
# The option bold makes texts bold, but it also makes the string bigger.
|
45
|
+
# Set bold to anything truthy or falsey, but better just go with true and false or nil
|
46
|
+
#
|
47
|
+
# The option blink makes the texts blink on supported terminals.
|
48
|
+
# Set blink to anything truthy or falsey, but better just go with true and false or nil
|
49
|
+
def gradient(*arg_colours, bg: false, exclude_spaces: true, bold: false, blink: false)
|
44
50
|
temp = ''
|
45
51
|
flatten_colours = arg_colours.flatten
|
46
52
|
|
@@ -59,6 +65,9 @@ class String
|
|
59
65
|
init = bg ? 48 : 38
|
60
66
|
|
61
67
|
each_line do |c|
|
68
|
+
temp << "\e[1m".freeze if bold
|
69
|
+
temp << "\e[5m".freeze if blink
|
70
|
+
|
62
71
|
_r, _g, _b = r, g, b
|
63
72
|
chomped = !!c.chomp!(''.freeze)
|
64
73
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_dot_gradient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sourav Goswami
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An itty-bitty extension that adds gradient method to String class that
|
14
14
|
supports any hex colour, for Linux | Unix terminals only
|