csm 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/CHANGELOG.md +3 -0
- data/README.md +3 -0
- data/lib/color_scheme_manager.rb +33 -0
- data/lib/colors.rb +28 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ebba5592edea6ae81e92d27135e7b1d28536ac4c20042b49f1974ecf813264ab
|
4
|
+
data.tar.gz: b4d5863a670f2fed0a3b50c6ebf23225869d27cbe8b9fb0785248dbb034e1f19
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1ff200df4347d30b9450854b32e74d4198ed680427f1074f1ce5ab60d8fb0ade4be43c478c03a58721af250490a3d0701c6d8616ef18eaada09597dd5b1b8760
|
7
|
+
data.tar.gz: c11f6470a6e335bb89a880b640cb17d8ac571e8f7848d1542d7703df42c63462e6828a1e12fa5b965c9044c6b197232a21a1a318367bcd4d83e1c24a82d9a4f4
|
data/CHANGELOG.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require_relative 'colors'
|
3
|
+
|
4
|
+
# ColorSchemeManager manages color schemes
|
5
|
+
module ColorSchemeManager
|
6
|
+
class << self
|
7
|
+
attr_accessor :custom_settings_file
|
8
|
+
|
9
|
+
def load_colors(default_colors, custom_colors = {})
|
10
|
+
raise StandardError, 'DEFAULT_COLORS must be provided.' unless default_colors && !default_colors.empty?
|
11
|
+
|
12
|
+
if custom_colors.empty?
|
13
|
+
default_colors
|
14
|
+
else
|
15
|
+
default_colors.merge(custom_colors)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_custom_yaml_file(custom_settings_file)
|
20
|
+
raise ArgumentError, 'YAML file path must be provided.' unless custom_settings_file
|
21
|
+
|
22
|
+
custom_colors = {}
|
23
|
+
|
24
|
+
if File.exist?(custom_settings_file)
|
25
|
+
raise StandardError, "YAML file '#{custom_settings_file}' is empty!" if File.zero?(custom_settings_file)
|
26
|
+
|
27
|
+
config = YAML.load_file(custom_settings_file)['custom'] || {}
|
28
|
+
custom_colors = config
|
29
|
+
end
|
30
|
+
custom_colors || {}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/colors.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Colors module provides ANSI color codes for enhancing console output
|
2
|
+
module Colors
|
3
|
+
COLOR_CODES = {
|
4
|
+
'black' => 30,
|
5
|
+
'red' => 31,
|
6
|
+
'green' => 32,
|
7
|
+
'yellow' => 33,
|
8
|
+
'blue' => 34,
|
9
|
+
'purple' => 35,
|
10
|
+
'cyan' => 36,
|
11
|
+
'white' => 37
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
def color(color_code)
|
15
|
+
"\e[#{color_code}m#{self}\e[0m"
|
16
|
+
end
|
17
|
+
|
18
|
+
def light_color(lcolor_code)
|
19
|
+
"\e[1;#{lcolor_code}m#{self}\e[0m"
|
20
|
+
end
|
21
|
+
|
22
|
+
COLOR_CODES.each do |name, code|
|
23
|
+
define_method(name) { "\e[#{code}m#{self}\e[0m" }
|
24
|
+
define_method("light_#{name}") { "\e[1;#{code}m#{self}\e[0m" }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
String.include(Colors)
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: csm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Endormi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-04-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yaml
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: The csm gem (color scheme manager) for your projects enabling customization
|
28
|
+
and management of color schemes.
|
29
|
+
email:
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- CHANGELOG.md
|
35
|
+
- README.md
|
36
|
+
- lib/color_scheme_manager.rb
|
37
|
+
- lib/colors.rb
|
38
|
+
homepage: https://github.com/endormi/csm
|
39
|
+
licenses:
|
40
|
+
- MIT
|
41
|
+
metadata: {}
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2.5'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements: []
|
57
|
+
rubygems_version: 3.1.2
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Color scheme manager gem for your projects
|
61
|
+
test_files: []
|