rbstyle 0.1.0
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/library/dynamic_colors.rb +108 -0
- data/library/static_colors.rb +25 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 316b7cd5ec8df53776b735d78c5d409243781673893b0bfb33012c5811e190ac
|
|
4
|
+
data.tar.gz: d68a4167ef67c5d4959b0192951246be4d43e5a78c54dad1380ff14559a08f2f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d9623b2245cc903b1286966a41edcaf1b38a0b89816dcac8e055773d3c697253ffa841ec0346aeeeca527f7b19055a3d5bd40d6c6cd0c82553338a5dcbc01641
|
|
7
|
+
data.tar.gz: 4485c2cd03456291b16f3e7857acc124b68cbc14374c4e97dcedbf119933dd3692a3d5cf975e0f95704123d0b5c0544373b549a6cca46c6aee3b261d4602ffe5
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# library/dynamic_colors.rb
|
|
2
|
+
require 'io/console'
|
|
3
|
+
|
|
4
|
+
module DynamicColors
|
|
5
|
+
def self._makergbcol(var1, var2)
|
|
6
|
+
col = var1[0, 12].dup
|
|
7
|
+
var2[0, 12].each { |c| col << c }
|
|
8
|
+
col.reverse.each { |c| col << c }
|
|
9
|
+
col
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
BLACK_TO_WHITE = ["m;m;m"]
|
|
13
|
+
BLACK_TO_RED = ["m;0;0"]
|
|
14
|
+
BLACK_TO_GREEN = ["0;m;0"]
|
|
15
|
+
BLACK_TO_BLUE = ["0;0;m"]
|
|
16
|
+
WHITE_TO_BLACK = ["n;n;n"]
|
|
17
|
+
WHITE_TO_RED = ["255;n;n"]
|
|
18
|
+
WHITE_TO_GREEN = ["n;255;n"]
|
|
19
|
+
WHITE_TO_BLUE = ["n;n;255"]
|
|
20
|
+
RED_TO_BLACK = ["n;0;0"]
|
|
21
|
+
RED_TO_WHITE = ["255;m;m"]
|
|
22
|
+
RED_TO_YELLOW = ["255;m;0"]
|
|
23
|
+
RED_TO_PURPLE = ["255;0;m"]
|
|
24
|
+
GREEN_TO_BLACK = ["0;n;0"]
|
|
25
|
+
GREEN_TO_WHITE = ["m;255;m"]
|
|
26
|
+
GREEN_TO_YELLOW = ["m;255;0"]
|
|
27
|
+
GREEN_TO_CYAN = ["0;255;m"]
|
|
28
|
+
BLUE_TO_BLACK = ["0;0;n"]
|
|
29
|
+
BLUE_TO_WHITE = ["m;m;255"]
|
|
30
|
+
BLUE_TO_CYAN = ["0;m;255"]
|
|
31
|
+
BLUE_TO_PURPLE = ["m;0;255"]
|
|
32
|
+
YELLOW_TO_RED = ["255;n;0"]
|
|
33
|
+
YELLOW_TO_GREEN = ["n;255;0"]
|
|
34
|
+
PURPLE_TO_RED = ["255;0;n"]
|
|
35
|
+
PURPLE_TO_BLUE = ["n;0;255"]
|
|
36
|
+
CYAN_TO_GREEN = ["0;255;n"]
|
|
37
|
+
CYAN_TO_BLUE = ["0;n;255"]
|
|
38
|
+
|
|
39
|
+
dynamic_colors = [
|
|
40
|
+
BLACK_TO_WHITE, BLACK_TO_RED, BLACK_TO_GREEN, BLACK_TO_BLUE,
|
|
41
|
+
WHITE_TO_BLACK, WHITE_TO_RED, WHITE_TO_GREEN, WHITE_TO_BLUE,
|
|
42
|
+
RED_TO_BLACK, RED_TO_WHITE, RED_TO_YELLOW, RED_TO_PURPLE,
|
|
43
|
+
GREEN_TO_BLACK, GREEN_TO_WHITE, GREEN_TO_YELLOW, GREEN_TO_CYAN,
|
|
44
|
+
BLUE_TO_BLACK, BLUE_TO_WHITE, BLUE_TO_CYAN, BLUE_TO_PURPLE,
|
|
45
|
+
YELLOW_TO_RED, YELLOW_TO_GREEN, PURPLE_TO_RED, PURPLE_TO_BLUE,
|
|
46
|
+
CYAN_TO_GREEN, CYAN_TO_BLUE
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
dynamic_colors.each do |color|
|
|
50
|
+
_col = 20
|
|
51
|
+
reversed_col = 220
|
|
52
|
+
|
|
53
|
+
dbl_col = 20
|
|
54
|
+
dbl_reversed_col = 220
|
|
55
|
+
|
|
56
|
+
content = color[0]
|
|
57
|
+
color.shift
|
|
58
|
+
|
|
59
|
+
12.times do
|
|
60
|
+
if content.include?('m')
|
|
61
|
+
result = content.gsub('m', _col.to_s)
|
|
62
|
+
color << result
|
|
63
|
+
elsif content.include?('n')
|
|
64
|
+
result = content.gsub('n', reversed_col.to_s)
|
|
65
|
+
color << result
|
|
66
|
+
end
|
|
67
|
+
_col += 20
|
|
68
|
+
reversed_col -= 20
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
12.times do
|
|
72
|
+
if content.include?('m')
|
|
73
|
+
result = content.gsub('m', dbl_reversed_col.to_s)
|
|
74
|
+
color << result
|
|
75
|
+
elsif content.include?('n')
|
|
76
|
+
result = content.gsub('n', dbl_col.to_s)
|
|
77
|
+
color << result
|
|
78
|
+
end
|
|
79
|
+
dbl_col += 20
|
|
80
|
+
dbl_reversed_col -= 20
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def self.ansiitest(text, color)
|
|
85
|
+
print "\033[38;2;#{color}m#{text}\033[0m"
|
|
86
|
+
end
|
|
87
|
+
def self.animated_colors(color_transition, index, text)
|
|
88
|
+
colors = DynamicColors.const_get(color_transition)
|
|
89
|
+
selected_color = colors[index - 1]
|
|
90
|
+
DynamicColors.ansiitest(text, selected_color)
|
|
91
|
+
puts
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def self.test_all_dynamic_colors
|
|
95
|
+
puts "Testing all dynamic color transitions:"
|
|
96
|
+
DynamicColors.constants.each do |const|
|
|
97
|
+
transition_name = const.to_s.split('_').map(&:capitalize).join(' ')
|
|
98
|
+
colors = DynamicColors.const_get(const)
|
|
99
|
+
puts "Transition: #{transition_name}"
|
|
100
|
+
colors.each_with_index do |color, index|
|
|
101
|
+
DynamicColors.ansiitest("Color #{index + 1}: Lorem Ipsum Random Text Test.", color)
|
|
102
|
+
puts
|
|
103
|
+
end
|
|
104
|
+
puts
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# library/static_colors.rb
|
|
2
|
+
module StaticColors
|
|
3
|
+
RED = "\e[38;2;255;0;0m"
|
|
4
|
+
GREEN = "\e[38;2;0;255;0m"
|
|
5
|
+
BLUE = "\e[38;2;0;0;255m"
|
|
6
|
+
WHITE = "\e[38;2;255;255;255m"
|
|
7
|
+
BLACK = "\e[38;2;0;0;0m"
|
|
8
|
+
GRAY = "\e[38;2;150;150;150m"
|
|
9
|
+
YELLOW = "\e[38;2;255;255;0m"
|
|
10
|
+
PURPLE = "\e[38;2;255;0;255m"
|
|
11
|
+
CYAN = "\e[38;2;0;255;255m"
|
|
12
|
+
ORANGE = "\e[38;2;255;150;0m"
|
|
13
|
+
PINK = "\e[38;2;255;0;150m"
|
|
14
|
+
TURQUOISE = "\e[38;2;0;150;255m"
|
|
15
|
+
LIGHT_GRAY = "\e[38;2;200;200;200m"
|
|
16
|
+
DARK_GRAY = "\e[38;2;100;100;100m"
|
|
17
|
+
LIGHT_RED = "\e[38;2;255;100;100m"
|
|
18
|
+
LIGHT_GREEN = "\e[38;2;100;255;100m"
|
|
19
|
+
LIGHT_BLUE = "\e[38;2;100;100;255m"
|
|
20
|
+
DARK_RED = "\e[38;2;100;0;0m"
|
|
21
|
+
DARK_GREEN = "\e[38;2;0;100;0m"
|
|
22
|
+
DARK_BLUE = "\e[38;2;0;0;100m"
|
|
23
|
+
RESET = WHITE
|
|
24
|
+
end
|
|
25
|
+
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rbstyle
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Codepulze
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2024-03-17 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Make eye catching console applications in ruby, check https://github.com/EvilBytecode/rbstyle
|
|
14
|
+
for more info.
|
|
15
|
+
email:
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- library/dynamic_colors.rb
|
|
21
|
+
- library/static_colors.rb
|
|
22
|
+
homepage:
|
|
23
|
+
licenses:
|
|
24
|
+
- MIT
|
|
25
|
+
metadata: {}
|
|
26
|
+
post_install_message:
|
|
27
|
+
rdoc_options: []
|
|
28
|
+
require_paths:
|
|
29
|
+
- lib
|
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '2.6'
|
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
requirements: []
|
|
41
|
+
rubygems_version: 3.4.19
|
|
42
|
+
signing_key:
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: Console Application Styler
|
|
45
|
+
test_files: []
|