utility_palettes 0.1.1 → 1.0.1

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.
@@ -1,46 +1,48 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityPalettes
4
- class Defaults
5
- def self.absolutes
6
- {
7
- 'red' => 'hsl(2, 78%, 64%)',
8
- 'rust' => 'hsl(16, 82%, 62%)',
9
- 'orange' => 'hsl(31, 90%, 65%)',
10
- 'gold' => 'hsl(46, 93%, 54%)',
11
- 'yellow' => 'hsl(58, 87%, 55%)',
12
- 'pear' => 'hsl(80, 74%, 57%)',
13
- 'green' => 'hsl(110, 69%, 58%)',
14
- 'seaside' => 'hsl(156, 78%, 57%)',
15
- 'cyan' => 'hsl(180, 69%, 37%)',
16
- 'capri' => 'hsl(197, 90%, 46%)',
17
- 'blue' => 'hsl(214, 78%, 36%)',
18
- 'iris' => 'hsl(265, 87%, 57%)',
19
- 'purple' => 'hsl(279, 85%, 56%)',
20
- 'magenta' => 'hsl(300, 64%, 66%)',
21
- 'pink' => 'hsl(320, 74%, 66%)',
22
- 'satin' => 'hsl(348, 74%, 57%)',
23
- 'cement' => 'hsl(42, 6%, 87%)',
24
- 'grey' => 'hsl(0, 3%, 46%)',
25
- 'base' => 'hsl(0, 3%, 46%)'
26
- }
27
- end
28
-
29
- def self.relatives
30
- {
31
- 'success' => 'hsl(110, 69%, 58%)',
32
- 'danger' => 'hsl(2, 78%, 64%)',
33
- 'information' => 'hsl(214, 78%, 36%)',
34
- 'warning' => 'hsl(46, 93%, 54%)'
35
- }
36
- end
37
-
38
- def self.singles
39
- {
40
- 'white' => '#fff',
41
- 'black' => '#000',
42
- 'translucent' => 'rgba(0, 0, 0, 0.45)'
43
- }
44
- end
45
- end
46
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityPalettes
4
+ class Defaults
5
+ def self.absolutes
6
+ {
7
+ 'red' => 'hsl(2, 78%, 64%)',
8
+ 'rust' => 'hsl(16, 82%, 62%)',
9
+ 'orange' => 'hsl(31, 90%, 65%)',
10
+ 'gold' => 'hsl(46, 93%, 54%)',
11
+ 'yellow' => 'hsl(58, 87%, 55%)',
12
+ 'pear' => 'hsl(80, 74%, 57%)',
13
+ 'green' => 'hsl(110, 69%, 58%)',
14
+ 'seaside' => 'hsl(156, 78%, 57%)',
15
+ 'cyan' => 'hsl(180, 69%, 37%)',
16
+ 'capri' => 'hsl(197, 90%, 46%)',
17
+ 'blue' => 'hsl(214, 78%, 36%)',
18
+ 'iris' => 'hsl(265, 87%, 57%)',
19
+ 'purple' => 'hsl(279, 85%, 56%)',
20
+ 'magenta' => 'hsl(300, 64%, 66%)',
21
+ 'pink' => 'hsl(320, 74%, 66%)',
22
+ 'satin' => 'hsl(348, 74%, 57%)',
23
+ 'cement' => 'hsl(42, 6%, 87%)',
24
+ 'grey' => 'hsl(0, 3%, 46%)',
25
+ 'base' => 'hsl(0, 3%, 46%)'
26
+ }
27
+ end
28
+
29
+ def self.relatives
30
+ {
31
+ 'success' => 'hsl(110, 69%, 58%)',
32
+ 'danger' => 'hsl(2, 78%, 64%)',
33
+ 'information' => 'hsl(214, 78%, 36%)',
34
+ 'warning' => 'hsl(46, 93%, 54%)'
35
+ }
36
+ end
37
+
38
+ def self.singles
39
+ {
40
+ 'white' => '#fff',
41
+ 'black' => '#000',
42
+ 'translucent' => 'rgba(0, 0, 0, 0.45)'
43
+ }
44
+ end
45
+
46
+ # TODO: add tailwind v4 absolutes
47
+ end
48
+ end
@@ -1,122 +1,126 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityPalettes
4
- class Outputs
5
- def self.generate(generated_palettes, config)
6
- output_format = config.dig(:output, :format).to_s.downcase.presence
7
- output_palettes = {}
8
-
9
- generated_palettes.each do |label, colourize_colour|
10
- case output_format
11
- when 'rgb'
12
- values = colourize_colour.rgb.values
13
- when 'hsl'
14
- values = colourize_colour.hsl.values
15
- values[1] = self.append_percentage(values[1])
16
- values[2] = self.append_percentage(values[2])
17
- when 'hsv'
18
- values = colourize_colour.hsv.values
19
- values[1] = self.append_percentage(values[1])
20
- values[2] = self.append_percentage(values[2])
21
- when 'hsb'
22
- values = colourize_colour.hsb.values
23
- values[1] = self.append_percentage(values[1])
24
- values[2] = self.append_percentage(values[2])
25
- when 'cmyk'
26
- values = colourize_colour.cmyk.values
27
- values[1] = self.append_percentage(values[1])
28
- values[2] = self.append_percentage(values[2])
29
- values[3] = self.append_percentage(values[3])
30
- output_format = 'device-cmyk'
31
- when 'cielab', 'lab'
32
- values = colourize_colour.cielab.values
33
- values[0] = self.append_percentage(values[0])
34
- output_format = 'lab'
35
- when 'cielch', 'lch'
36
- values = colourize_colour.cielch.values
37
- values[0] = self.append_percentage(values[0])
38
- output_format = 'lch'
39
- when 'hex'
40
- values = colourize_colour.hex
41
- else
42
- values = colourize_colour.rgb.values
43
- output_format = 'rgb'
44
- end
45
-
46
- case output_format
47
- when 'hex'
48
- values += (colourize_colour.alpha * 255).round.to_s(16).slice(0, 2).upcase if colourize_colour.alpha < 1.0
49
- output_palettes[label] = values
50
- else
51
- values << self.append_alpha(colourize_colour.alpha) if colourize_colour.alpha < 1.0
52
- output_palettes[label] = "#{output_format}(#{values.join(' ')})"
53
- end
54
- end
55
-
56
- output_palettes
57
- end
58
-
59
- def self.json(filename, output_palettes)
60
- file = Tempfile.new([filename, '.json'])
61
-
62
- File.open(file, 'w') do |f|
63
- f.write(JSON.pretty_generate(output_palettes))
64
- end
65
-
66
- puts 'Exporting utility palettes JSON...'
67
- file
68
- end
69
-
70
- def self.scss(filename, output_palettes)
71
- file = Tempfile.new([filename, '.scss'])
72
-
73
- File.open(file, 'w') do |f|
74
- f.write(output_palettes.collect { |label, hex| "$#{label}: #{hex};" }.join("\n"))
75
- end
76
-
77
- puts 'Exporting utility palettes SCSS...'
78
- file
79
- end
80
-
81
- def self.css(filename, output_palettes)
82
- file = Tempfile.new([filename, '.css'])
83
-
84
- File.open(file, 'w') do |f|
85
- f.write(":root {\n\t#{output_palettes.collect { |label, hex| "--#{label}: #{hex};" }.join("\n\t")}\n}")
86
- end
87
-
88
- puts 'Exporting utility palettes CSS...'
89
- file
90
- end
91
-
92
- def bespoke_property_variables
93
- # const utilities = {
94
- # bg: (value) => ({ 'background-color': value }),
95
- # text: (value) => ({ 'color': value }),
96
- # border: (value) => ({ 'border-color': value }),
97
- # 'border-t': (value) => ({ '--tw-border-opacity': 1, 'border-top-color': value }),
98
- # 'border-r': (value) => ({ '--tw-border-opacity': 1, 'border-right-color': value }),
99
- # 'border-b': (value) => ({ '--tw-border-opacity': 1, 'border-bottom-color': value }),
100
- # 'border-l': (value) => ({ '--tw-border-opacity': 1, 'border-left-color': value }),
101
- # outline: (value) => ({ 'outline-color': value }),
102
- # ring: (value) => ({ '--tw-ring-opacity': 1, '--tw-ring-color': value }),
103
- # 'ring-offset': (value) => ({ '--tw-ring-offset-color': value }),
104
- # 'shadow': (value) => ({ '--tw-shadow-color': value, '--tw-shadow': 'var(--tw-shadow-colored)' }),
105
- # accent: (value) => ({ 'accent-color': value }),
106
- # caret: (value) => ({ 'caret-color': value }),
107
- # fill: (value) => ({ 'fill': value }),
108
- # stroke: (value) => ({ 'stroke': value }),
109
- # };
110
- end
111
-
112
- private
113
-
114
- def self.append_percentage(value)
115
- "#{value}%"
116
- end
117
-
118
- def self.append_alpha(alpha)
119
- "/ #{alpha * 100}"
120
- end
121
- end
122
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityPalettes
4
+ class Outputs
5
+ def self.generate(generated_palettes)
6
+ output_format = UtilityPalettes.configuration.output_format.to_s.downcase.presence
7
+ output_palettes = {}
8
+
9
+ generated_palettes.each do |label, colourize_colour|
10
+ case output_format
11
+ when 'rgb'
12
+ values = colourize_colour.rgb.values
13
+ when 'hsl'
14
+ values = colourize_colour.hsl.values
15
+ values[1] = self.append_percentage(values[1])
16
+ values[2] = self.append_percentage(values[2])
17
+ when 'hsv'
18
+ values = colourize_colour.hsv.values
19
+ values[1] = self.append_percentage(values[1])
20
+ values[2] = self.append_percentage(values[2])
21
+ when 'hsb'
22
+ values = colourize_colour.hsb.values
23
+ values[1] = self.append_percentage(values[1])
24
+ values[2] = self.append_percentage(values[2])
25
+ when 'cmyk'
26
+ values = colourize_colour.cmyk.values
27
+ values[1] = self.append_percentage(values[1])
28
+ values[2] = self.append_percentage(values[2])
29
+ values[3] = self.append_percentage(values[3])
30
+ output_format = 'device-cmyk'
31
+ when 'cielab', 'lab'
32
+ values = colourize_colour.cielab.values
33
+ values[0] = self.append_percentage(values[0])
34
+ output_format = 'lab'
35
+ when 'cielch', 'lch'
36
+ values = colourize_colour.cielch.values
37
+ values[0] = self.append_percentage(values[0])
38
+ output_format = 'lch'
39
+ when 'hex'
40
+ values = colourize_colour.hex
41
+ else
42
+ values = colourize_colour.rgb.values
43
+ output_format = 'rgb'
44
+ end
45
+
46
+ case output_format
47
+ when 'hex'
48
+ values += (colourize_colour.alpha * 255).round.to_s(16).slice(0, 2).upcase if colourize_colour.alpha < 1.0
49
+ output_palettes[label] = values
50
+ else
51
+ values << self.append_alpha(colourize_colour.alpha) if colourize_colour.alpha < 1.0
52
+ output_palettes[label] = "#{output_format}(#{values.join(' ')})"
53
+ end
54
+ end
55
+
56
+ # TODO: sort by non-ASCII so that -50 is before -100 -> `naturally` gem
57
+ output_palettes.sort.to_h
58
+ end
59
+
60
+ def self.json(filename, output_palettes)
61
+ content = JSON.pretty_generate(output_palettes)
62
+ filepath = "#{filename}.json"
63
+
64
+ # Create directory if it doesn't exist
65
+ FileUtils.mkdir_p(File.dirname(filepath))
66
+ File.write(filepath, content)
67
+
68
+ puts 'Exporting utility palettes JSON...'
69
+ true
70
+ end
71
+
72
+ def self.scss(filename, output_palettes)
73
+ content = output_palettes.collect { |label, hex| "$#{label}: #{hex};" }.join("\n")
74
+ filepath = "#{filename}.scss"
75
+
76
+ # Create directory if it doesn't exist
77
+ FileUtils.mkdir_p(File.dirname(filepath))
78
+ File.write(filepath, content)
79
+
80
+ puts 'Exporting utility palettes SCSS...'
81
+ true
82
+ end
83
+
84
+ def self.css(filename, output_palettes)
85
+ content = ":root {\n\t#{output_palettes.collect { |label, hex| "--#{label}: #{hex};" }.join("\n\t")}\n}"
86
+ filepath = "#{filename}.css"
87
+
88
+ # Create directory if it doesn't exist
89
+ FileUtils.mkdir_p(File.dirname(filepath))
90
+ File.write(filepath, content)
91
+
92
+ puts 'Exporting utility palettes CSS...'
93
+ true
94
+ end
95
+
96
+ def bespoke_property_variables
97
+ # const utilities = {
98
+ # bg: (value) => ({ 'background-color': value }),
99
+ # text: (value) => ({ 'color': value }),
100
+ # border: (value) => ({ 'border-color': value }),
101
+ # 'border-t': (value) => ({ '--tw-border-opacity': 1, 'border-top-color': value }),
102
+ # 'border-r': (value) => ({ '--tw-border-opacity': 1, 'border-right-color': value }),
103
+ # 'border-b': (value) => ({ '--tw-border-opacity': 1, 'border-bottom-color': value }),
104
+ # 'border-l': (value) => ({ '--tw-border-opacity': 1, 'border-left-color': value }),
105
+ # outline: (value) => ({ 'outline-color': value }),
106
+ # ring: (value) => ({ '--tw-ring-opacity': 1, '--tw-ring-color': value }),
107
+ # 'ring-offset': (value) => ({ '--tw-ring-offset-color': value }),
108
+ # 'shadow': (value) => ({ '--tw-shadow-color': value, '--tw-shadow': 'var(--tw-shadow-colored)' }),
109
+ # accent: (value) => ({ 'accent-color': value }),
110
+ # caret: (value) => ({ 'caret-color': value }),
111
+ # fill: (value) => ({ 'fill': value }),
112
+ # stroke: (value) => ({ 'stroke': value }),
113
+ # };
114
+ end
115
+
116
+ private
117
+
118
+ def self.append_percentage(value)
119
+ "#{value}%"
120
+ end
121
+
122
+ def self.append_alpha(alpha)
123
+ "/ #{alpha * 100}"
124
+ end
125
+ end
126
+ end
@@ -1,133 +1,120 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityPalettes
4
- class Palettes
5
- def self.generate(config)
6
- @config = config
7
-
8
- puts 'Generating utility palettes...'
9
-
10
- UtilityPalettes::Validations.validate_config(@config)
11
- @increment_steppers = UtilityPalettes::Configuration.setup(@config)
12
-
13
- puts 'Retrieved configuration...'
14
-
15
- default_absolutes = @config.dig(:defaults, :absolutes) == false ? {} : UtilityPalettes::Defaults.absolutes
16
- default_relatives = @config.dig(:defaults, :relatives) == false ? {} : UtilityPalettes::Defaults.relatives
17
- default_singles = @config.dig(:defaults, :singles) == false ? {} : UtilityPalettes::Defaults.singles
18
-
19
- puts 'Defined default palettes...'
20
-
21
- user_absolutes = @config.dig(:absolutes) || {}
22
- user_relatives = @config.dig(:relatives) || {}
23
- user_singles = @config.dig(:singles) || {}
24
-
25
- puts 'Retrieved user palettes...'
26
-
27
- # merging should mean any user colours will overwrite default colours with the same key names
28
- combined_absolutes = default_absolutes.merge(user_absolutes)
29
- combined_relatives = default_relatives.merge(user_relatives)
30
- combined_singles = {}.merge(default_absolutes, user_absolutes, default_singles, user_singles)
31
-
32
- @combined_samples = combined_absolutes.merge(combined_relatives).merge(combined_singles)
33
-
34
- puts 'Merged palettes...'
35
-
36
- converted_absolutes = self.colourize_values(combined_absolutes)
37
- converted_relatives = self.colourize_values(combined_relatives)
38
- converted_singles = self.colourize_values(combined_singles)
39
-
40
- puts 'Converted palettes...'
41
-
42
- generated_absolutes = self.palette_looper(converted_absolutes, 'absolutes')
43
- generated_relatives = self.palette_looper(converted_relatives, 'relatives')
44
- generated_singles = converted_singles
45
-
46
- puts 'Generated utility palettes...'
47
-
48
- generated_palettes = {}.merge(generated_absolutes, generated_relatives, generated_singles)
49
- generated_palettes = self.format_palette(generated_palettes)
50
- output_palettes = UtilityPalettes::Outputs.generate(generated_palettes, @config)
51
-
52
- filename = 'utility_palettes'
53
- filename += "-#{Time.zone.now.strftime('%Y%m%d-%H%M%S')}" if @config.dig(:output, :dated) == true
54
-
55
- output_files = (@config.dig(:output, :files) || '').split(',').map(&:strip)
56
-
57
- file = nil
58
- file = UtilityPalettes::Outputs.json(filename, output_palettes) if output_files.blank? || output_files.include?('json')
59
- File.rename(file.path, "#{filename}.json") if file.present?
60
-
61
- file = nil
62
- file = UtilityPalettes::Outputs.scss(filename, output_palettes) if output_files.include?('scss')
63
- File.rename(file.path, "app/assets/stylesheets/#{filename}.scss") if file.present?
64
-
65
- file = nil
66
- file = UtilityPalettes::Outputs.css(filename, output_palettes) if output_files.include?('css')
67
- File.rename(file.path, "app/assets/stylesheets/#{filename}.css") if file.present?
68
-
69
- true
70
- end
71
-
72
- private
73
-
74
- def self.colourize_values(colour_hash)
75
- colourized_hash = {}
76
-
77
- colour_hash.each do |label, colour|
78
- begin
79
- if colour.start_with?('$')
80
- # if the colour label begins with $ then it is a reference to a different defined colour, so must be looked up in the main
81
- colourized_hash[label] = ColorConverters::Color.new(@combined_samples.dig(colour[1..].to_sym))
82
- else
83
- colourized_hash[label] = ColorConverters::Color.new(colour)
84
- end
85
-
86
- # TODO
87
- # provide a name if the label is left blank
88
- # if label.to_s == '$blank'
89
- # hash[colourized_hash[label].name] = hash.delete(label)
90
- # puts "Blank colour #{colour} has been given the name: #{colourized_hash[label].name}"
91
- # end
92
- rescue ColorConverters::InvalidColorError => e
93
- warn "Error processing colour #{label} with value #{colour}: #{e.message}"
94
- end
95
- end
96
-
97
- colourized_hash
98
- end
99
-
100
- # * Palettes
101
-
102
- # ? Multiple Colour's Palette
103
- # a function to loop through a map of colours and create absolute or relative palettes for them all and collect this into a single map
104
-
105
- def self.palette_looper(colour_map, method)
106
- looped_generated_palettes = {}
107
-
108
- colour_map.each do |label, base_colour|
109
- # create a palette for a single colour from the providing mapping
110
- if method == 'absolutes'
111
- generated_swatches = UtilityPalettes::Swatch.absolute_generator(label, base_colour, @config.dig(:method), @increment_steppers)
112
- elsif method == 'relatives'
113
- generated_swatches = UtilityPalettes::Swatch.relative_generator(label, base_colour, @config.dig(:method), @increment_steppers)
114
- end
115
-
116
- # merge the colours absolute palette into the collective mapping
117
- looped_generated_palettes = {}.merge(looped_generated_palettes, generated_swatches)
118
- end
119
-
120
- looped_generated_palettes
121
- end
122
-
123
- def self.format_palette(palettes)
124
- palettes.compact_blank!
125
-
126
- palettes.transform_keys!(&:to_s)
127
- palettes.transform_keys! { |key| @config.dig(:output, :prefix) + key } if @config.dig(:output, :prefix).present?
128
- palettes.transform_keys! { |key| key + @config.dig(:output, :suffix) } if @config.dig(:output, :suffix).present?
129
-
130
- palettes
131
- end
132
- end
133
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityPalettes
4
+ class Palettes
5
+ def self.generate
6
+ configuration = UtilityPalettes.configuration
7
+
8
+ puts 'Generating utility palettes...'
9
+
10
+ default_absolutes = configuration.use_default_absolutes == true ? UtilityPalettes::Defaults.absolutes : {}
11
+ default_relatives = configuration.use_default_relatives == true ? UtilityPalettes::Defaults.relatives : {}
12
+ default_singles = configuration.use_default_singles == true ? UtilityPalettes::Defaults.singles : {}
13
+
14
+ puts 'Defined default palettes...'
15
+
16
+ user_absolutes = configuration.absolutes
17
+ user_relatives = configuration.relatives
18
+ user_singles = configuration.singles
19
+
20
+ puts 'Retrieved user palettes...'
21
+
22
+ # merging should mean any user colours will overwrite default colours with the same key names
23
+ combined_absolutes = default_absolutes.merge(user_absolutes)
24
+ combined_relatives = default_relatives.merge(user_relatives)
25
+ combined_singles = {}.merge(default_absolutes, user_absolutes, default_singles, user_singles)
26
+
27
+ @combined_samples = combined_absolutes.merge(combined_relatives).merge(combined_singles)
28
+
29
+ puts 'Merged palettes...'
30
+
31
+ converted_absolutes = self.colourize_values(combined_absolutes)
32
+ converted_relatives = self.colourize_values(combined_relatives)
33
+ converted_singles = self.colourize_values(combined_singles)
34
+
35
+ puts 'Converted palettes...'
36
+
37
+ generated_absolutes = self.palette_looper(converted_absolutes, 'absolutes')
38
+ generated_relatives = self.palette_looper(converted_relatives, 'relatives')
39
+ generated_singles = converted_singles
40
+
41
+ puts 'Generated utility palettes...'
42
+
43
+ generated_palettes = {}.merge(generated_absolutes, generated_relatives, generated_singles)
44
+ generated_palettes = self.format_palette(generated_palettes)
45
+ output_palettes = UtilityPalettes::Outputs.generate(generated_palettes)
46
+
47
+ filename = configuration.output_filename
48
+ filename += "-#{Time.zone.now.strftime('%Y%m%d-%H%M%S')}" if configuration.output_dated == true
49
+
50
+ output_files = configuration.output_files.map(&:strip)
51
+
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')
55
+
56
+ true
57
+ end
58
+
59
+ private
60
+
61
+ def self.colourize_values(basic_hash)
62
+ colourized_hash = {}
63
+
64
+ basic_hash.each do |label, colour|
65
+ begin
66
+ if colour.is_a?(String) && colour.start_with?('$')
67
+ # if the colour label begins with $ then it is a reference to a different defined colour, so must be looked up in the main
68
+ colourized_hash[label] = ColorConverters::Color.new(@combined_samples.dig(colour.slice(1..-1).to_sym))
69
+ else
70
+ colourized_hash[label] = ColorConverters::Color.new(colour)
71
+ end
72
+
73
+ # TODO
74
+ # provide a name if the label is left blank
75
+ # if label.to_s == '$blank'
76
+ # hash[colourized_hash[label].name] = hash.delete(label)
77
+ # puts "Blank colour #{colour} has been given the name: #{colourized_hash[label].name}"
78
+ # end
79
+ rescue ColorConverters::InvalidColorError => e
80
+ warn "Error processing colour #{label} with value #{colour}: #{e.message}"
81
+ end
82
+ end
83
+
84
+ colourized_hash
85
+ end
86
+
87
+ # * Palettes
88
+
89
+ # ? Multiple Colour's Palette
90
+ # a function to loop through a map of colours and create absolute or relative palettes for them all and collect this into a single map
91
+
92
+ def self.palette_looper(colourized_hash, palette_type)
93
+ looped_generated_palettes = {}
94
+
95
+ colourized_hash.each do |label, base_colour|
96
+ # create a palette for a single colour from the providing mapping
97
+ if palette_type == 'absolutes'
98
+ generated_swatches = UtilityPalettes::Swatch.absolute_generator(label, base_colour)
99
+ elsif palette_type == 'relatives'
100
+ generated_swatches = UtilityPalettes::Swatch.relative_generator(label, base_colour)
101
+ end
102
+
103
+ # merge the colours absolute palette into the collective mapping
104
+ looped_generated_palettes.merge!(generated_swatches)
105
+ end
106
+
107
+ looped_generated_palettes
108
+ end
109
+
110
+ def self.format_palette(generated_hash)
111
+ configuration = UtilityPalettes.configuration
112
+
113
+ generated_hash.transform_keys!(&:to_s)
114
+ generated_hash.transform_keys! { |key| configuration.output_prefix + key } if configuration.output_prefix.present?
115
+ generated_hash.transform_keys! { |key| key + configuration.output_suffix } if configuration.output_suffix.present?
116
+
117
+ generated_hash
118
+ end
119
+ end
120
+ end