utility_palettes 1.0.0 → 1.0.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 +4 -4
- data/README.md +13 -11
- data/lib/generators/templates/config/utility_palettes.rb +2 -1
- data/lib/utility_palettes/configuration.rb +3 -2
- data/lib/utility_palettes/outputs.rb +20 -16
- data/lib/utility_palettes/palettes.rb +4 -12
- data/lib/utility_palettes/version.rb +5 -5
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dd0760b2f72cc78a687afcbf878d4e88a936cc4503bba60d46c73e1df21467c
|
4
|
+
data.tar.gz: a85e503c4b282647c6001446950e58ebcf32bef6549e0f68a8e226264fb8e14f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c5569c8bc1bc5eb3eb2916dd45b29fc211eb4bae211c10d7aeae20c933e79b7efc4dc9e0af27a6654ecc256890645758949c66424f46573df18f1e4f3003aff
|
7
|
+
data.tar.gz: ff3a66f8ed5839f3b25608ecf6836aaeae7ba99ae02bd67dccfb3b2f2797a5f5d3f98456d557ac22efbe521fb4769e67fdd59cebaf2c5a09a51913629ad96ff8
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# UtilityPalettes
|
2
2
|
|
3
|
+

|
4
|
+
[](https://rubygems.org/gems/utility_palettes)
|
5
|
+
|
3
6
|
> Generate your own colour palettes in an instance.
|
4
7
|
|
5
8
|
Utility Palettes is an ruby gem package for use in ruby or other projects that generates palettes and shades based on supplied colours.
|
@@ -22,13 +25,13 @@ gem install utility_palettes
|
|
22
25
|
|
23
26
|
## Usage
|
24
27
|
|
25
|
-
To get the config
|
28
|
+
To get the config file:
|
26
29
|
|
27
30
|
```bash
|
28
31
|
rails generate utility_palettes:config
|
29
32
|
```
|
30
33
|
|
31
|
-
|
34
|
+
To generate the palettes:
|
32
35
|
|
33
36
|
```bash
|
34
37
|
rails generate utility_palettes:generate
|
@@ -63,15 +66,14 @@ Should the default colours be included for the palette generator. Even if they a
|
|
63
66
|
|
64
67
|
How the output file and values should be written:
|
65
68
|
|
66
|
-
| Option
|
67
|
-
| :------------
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
74
|
-
The JSON output file will appear at the top-level of your project, while SCSS and CSS are defined to go to `app/assets/stylesheets`.
|
69
|
+
| Option | Description | Default | Value Type | Possible Values |
|
70
|
+
| :------------ | :-------------------------------------------------------------------------------- | :----------------: | :--------: | :-----------------------------------------------------: |
|
71
|
+
| ouput_filename | Where the file should be output to including filename, without the file extension | 'utility_palettes' | String | <any filepath string> |
|
72
|
+
| ouput_dated | Should a timestamp be included in the filenames | false | Boolean | true / false |
|
73
|
+
| ouput_files | The types of files the palette should be output in | ['scss'] | Array | json, scss, css |
|
74
|
+
| ouput_format | The colour syntax the output colours should be written in | hex | String | rgb, hsl, hsv, hsb, cmyk, cielab, lab, cielch, lch, hex |
|
75
|
+
| ouput_prefix | A string that is appended to the start of all colour names, i.e. 'up-' | nil | String | <any string> |
|
76
|
+
| ouput_suffix | A string that is appended to the end of all colour names, i.e. '-col' | nil | String | <any string> |
|
75
77
|
|
76
78
|
### Method (WIP)
|
77
79
|
|
@@ -10,8 +10,9 @@ UtilityPalettes.configure do |config|
|
|
10
10
|
# config.default_singles = true
|
11
11
|
|
12
12
|
# Output
|
13
|
+
# config.output_filename = 'utility_palettes'
|
13
14
|
# config.output_dated = false
|
14
|
-
# config.output_files = ['
|
15
|
+
# config.output_files = ['scss']
|
15
16
|
# config.output_format = 'hex'
|
16
17
|
# config.output_prefix = nil
|
17
18
|
# config.output_suffix = nil
|
@@ -4,7 +4,7 @@ module UtilityPalettes
|
|
4
4
|
class Configuration
|
5
5
|
attr_accessor :enable_environments,
|
6
6
|
:use_default_absolutes, :use_default_relatives, :use_default_singles,
|
7
|
-
:output_dated, :output_files, :output_format, :output_prefix, :output_suffix,
|
7
|
+
:output_filename, :output_dated, :output_files, :output_format, :output_prefix, :output_suffix,
|
8
8
|
:method, :steps_h, :steps_s, :steps_l, :steps_r, :steps_g, :steps_b,
|
9
9
|
:absolutes, :relatives, :singles
|
10
10
|
|
@@ -18,8 +18,9 @@ module UtilityPalettes
|
|
18
18
|
@use_default_singles = true
|
19
19
|
|
20
20
|
# Output
|
21
|
+
@output_filename = 'utility_palettes'
|
21
22
|
@output_dated = false
|
22
|
-
@output_files = ['
|
23
|
+
@output_files = ['scss']
|
23
24
|
@output_format = 'hex'
|
24
25
|
@output_prefix = ''
|
25
26
|
@output_suffix = ''
|
@@ -53,40 +53,44 @@ module UtilityPalettes
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
|
56
|
+
# TODO: sort by non-ASCII so that -50 is before -100 -> `naturally` gem
|
57
|
+
output_palettes.sort.to_h
|
57
58
|
end
|
58
59
|
|
59
60
|
def self.json(filename, output_palettes)
|
60
|
-
|
61
|
+
content = JSON.pretty_generate(output_palettes)
|
62
|
+
filepath = "#{filename}.json"
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
# Create directory if it doesn't exist
|
65
|
+
FileUtils.mkdir_p(File.dirname(filepath))
|
66
|
+
File.write(filepath, content)
|
65
67
|
|
66
68
|
puts 'Exporting utility palettes JSON...'
|
67
|
-
|
69
|
+
true
|
68
70
|
end
|
69
71
|
|
70
72
|
def self.scss(filename, output_palettes)
|
71
|
-
|
73
|
+
content = output_palettes.collect { |label, hex| "$#{label}: #{hex};" }.join("\n")
|
74
|
+
filepath = "#{filename}.scss"
|
72
75
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
+
# Create directory if it doesn't exist
|
77
|
+
FileUtils.mkdir_p(File.dirname(filepath))
|
78
|
+
File.write(filepath, content)
|
76
79
|
|
77
80
|
puts 'Exporting utility palettes SCSS...'
|
78
|
-
|
81
|
+
true
|
79
82
|
end
|
80
83
|
|
81
84
|
def self.css(filename, output_palettes)
|
82
|
-
|
85
|
+
content = ":root {\n\t#{output_palettes.collect { |label, hex| "--#{label}: #{hex};" }.join("\n\t")}\n}"
|
86
|
+
filepath = "#{filename}.css"
|
83
87
|
|
84
|
-
|
85
|
-
|
86
|
-
|
88
|
+
# Create directory if it doesn't exist
|
89
|
+
FileUtils.mkdir_p(File.dirname(filepath))
|
90
|
+
File.write(filepath, content)
|
87
91
|
|
88
92
|
puts 'Exporting utility palettes CSS...'
|
89
|
-
|
93
|
+
true
|
90
94
|
end
|
91
95
|
|
92
96
|
def bespoke_property_variables
|
@@ -44,22 +44,14 @@ module UtilityPalettes
|
|
44
44
|
generated_palettes = self.format_palette(generated_palettes)
|
45
45
|
output_palettes = UtilityPalettes::Outputs.generate(generated_palettes)
|
46
46
|
|
47
|
-
filename =
|
47
|
+
filename = configuration.output_filename
|
48
48
|
filename += "-#{Time.zone.now.strftime('%Y%m%d-%H%M%S')}" if configuration.output_dated == true
|
49
49
|
|
50
50
|
output_files = configuration.output_files.map(&:strip)
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
file = nil
|
57
|
-
file = UtilityPalettes::Outputs.scss(filename, output_palettes) if output_files.include?('scss')
|
58
|
-
File.rename(file.path, "app/assets/stylesheets/#{filename}.scss") if file.present?
|
59
|
-
|
60
|
-
file = nil
|
61
|
-
file = UtilityPalettes::Outputs.css(filename, output_palettes) if output_files.include?('css')
|
62
|
-
File.rename(file.path, "app/assets/stylesheets/#{filename}.css") if file.present?
|
52
|
+
UtilityPalettes::Outputs.json(filename, output_palettes) if output_files.include?('json')
|
53
|
+
UtilityPalettes::Outputs.scss(filename, output_palettes) if output_files.include?('scss')
|
54
|
+
UtilityPalettes::Outputs.css(filename, output_palettes) if output_files.include?('css')
|
63
55
|
|
64
56
|
true
|
65
57
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module UtilityPalettes
|
4
|
-
VERSION = '1.0.
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module UtilityPalettes
|
4
|
+
VERSION = '1.0.3'
|
5
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utility_palettes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis Davis
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-09-
|
10
|
+
date: 2025-09-05 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: color_converters
|
@@ -23,6 +23,20 @@ dependencies:
|
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: 0.1.2
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: railties
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '4.0'
|
26
40
|
description: Create broad colour palettes based on specific colour swatches, or more
|
27
41
|
specific light/dark variant palettes. Be in control of the colours you use and shorten
|
28
42
|
the iterative process when deciding on how to build your palettes.
|