utility_colors 0.1.8 → 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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +131 -174
  3. data/Rakefile +3 -7
  4. data/lib/generators/templates/config/utility_colors.rb +22 -0
  5. data/lib/generators/templates/palettes/_color-variables.scss +34 -0
  6. data/lib/generators/utility_colors/config_generator.rb +13 -0
  7. data/lib/generators/utility_colors/generate_generator.rb +31 -0
  8. data/lib/utility_colors/builders.rb +75 -0
  9. data/lib/utility_colors/colors.rb +106 -0
  10. data/lib/utility_colors/configuration.rb +67 -0
  11. data/lib/utility_colors/exports.rb +54 -0
  12. data/lib/utility_colors/imports.rb +42 -0
  13. data/lib/utility_colors/properties.rb +77 -0
  14. data/lib/utility_colors/version.rb +1 -1
  15. data/lib/utility_colors.rb +8 -1
  16. metadata +18 -35
  17. data/.npmignore +0 -28
  18. data/.rspec +0 -3
  19. data/.rubocop.yml +0 -13
  20. data/CHANGELOG.md +0 -46
  21. data/CODE_OF_CONDUCT.md +0 -84
  22. data/Gemfile +0 -12
  23. data/LICENSE.txt +0 -21
  24. data/examples/v0.1.8.png +0 -0
  25. data/index.js +0 -5
  26. data/package.json +0 -26
  27. data/utility_colors/_utility_colors.scss +0 -11
  28. data/utility_colors/utility_colors_files/functions/_functions.scss +0 -4
  29. data/utility_colors/utility_colors_files/functions/_mappings.scss +0 -25
  30. data/utility_colors/utility_colors_files/functions/_palettes.scss +0 -123
  31. data/utility_colors/utility_colors_files/functions/_references.scss +0 -7
  32. data/utility_colors/utility_colors_files/functions/_sequences.scss +0 -17
  33. data/utility_colors/utility_colors_files/mixins/_mixins.scss +0 -60
  34. data/utility_colors/utility_colors_files/utilities/_color.scss +0 -22
  35. data/utility_colors/utility_colors_files/validators/_validations.scss +0 -3
  36. data/utility_colors/utility_colors_files/variables/_color-variables.scss +0 -64
  37. data/utility_colors/utility_colors_files/variables/_mod-variables.scss +0 -53
  38. data/utility_colors/utility_colors_files/variables/_user-variables.scss +0 -78
  39. data/utility_colors/utility_colors_files/variables/_variables.scss +0 -3
@@ -1,123 +0,0 @@
1
- // * Palettes
2
-
3
- // ? Single Colour's Palette
4
- // a function to create a colour shade palette based off a single color input
5
- @function single-color-shades-palette($key, $base_color) {
6
- $single-color-palette: ();
7
-
8
- // colours are index inversely to their lightness
9
- $base-palette-index: palette-index($base_color);
10
- $single-color-palette: map-merge($single-color-palette, (#{palette-reference($key, $base_color, $base-palette-index)}: $base_color));
11
-
12
- // Lighter colours
13
- // calc the space available to create lightened colours based off the base colour
14
- @if $base-palette-index > 0 {
15
- @for $i from 1 through $base-palette-index {
16
- $col: color-step($base_color, $i, true);
17
- $single-color-palette: map-merge($single-color-palette, (#{palette-reference($key, $col, $base-palette-index - $i)}: $col));
18
- }
19
- }
20
-
21
- // Darker colours
22
- // calc the space available to create darkened colours based off the base colour
23
- @if $base-palette-index < 9 {
24
- @for $i from 1 through 9 - $base-palette-index {
25
- $col: color-step($base_color, $i, false);
26
- $single-color-palette: map-merge($single-color-palette, (#{palette-reference($key, $col, $base-palette-index + $i)}: $col));
27
- }
28
- }
29
-
30
- @return $single-color-palette;
31
- }
32
-
33
-
34
- // ? How to Calculate the next colour in the Palette
35
- @function color-step($color, $step, $lighter) {
36
- $color: hsl_sequence($color, $step, $lighter);
37
-
38
- @return $color;
39
- }
40
-
41
- @function palette-reference($key, $color, $index) {
42
- $reference: '';
43
-
44
- @if $index == 0 {
45
- $reference: #{$key + '-50'};
46
- } @else {
47
- $reference: #{$key + '-' + calc($index) + '00'};
48
- }
49
-
50
- @return $reference;
51
- }
52
-
53
-
54
- // ? Single Colour's Trio Palette
55
- // a function to create a trio shade palette based off a single color input
56
- @function single-color-tri-palette($key, $base_color) {
57
- $single-color-trio: ();
58
-
59
- $base-palette-index: palette-index($base_color);
60
- $single-color-trio: map-merge($single-color-trio, (#{$key}: $base_color));
61
-
62
- // Lighter colour
63
- @if $base-palette-index > 1 {
64
- $col: color-step($base_color, 2, true);
65
- $single-color-trio: map-merge($single-color-trio, (#{$key + '-light'}: $col));
66
- } @else if $base-palette-index > 0 {
67
- $col: color-step($base_color, 1, true);
68
- $single-color-trio: map-merge($single-color-trio, (#{$key + '-light'}: $col));
69
- } @else {
70
- $single-color-trio: map-merge($single-color-trio, (#{$key + '-light'}: null))
71
- }
72
-
73
- // Darker colour
74
- @if $base-palette-index < 8 {
75
- $col: color-step($base_color, 2, false);
76
- $single-color-trio: map-merge($single-color-trio, (#{$key + '-dark'}: $col));
77
- } @else if $base-palette-index < 9 {
78
- $col: color-step($base_color, 1, false);
79
- $single-color-trio: map-merge($single-color-trio, (#{$key + '-dark'}: $col));
80
- } @else {
81
- $single-color-trio: map-merge($single-color-trio, (#{$key + '-dark'}: null))
82
- }
83
-
84
- @return $single-color-trio;
85
- }
86
-
87
-
88
-
89
- // ? Multiple Colours
90
-
91
- // ? Multiple Colour's Palette
92
- // a function to loop through a map of colours and create shade palettes for them all and collect this into a single map
93
-
94
- @function multi-color-shades-palette($color-map) {
95
- $multi-color-palette: ();
96
-
97
- @each $key, $base_color in $color-map {
98
- // create a palette for a single colour from the providing mapping
99
- $new-palette: single-color-shades-palette($key, $base_color);
100
-
101
- // merge the colours shade palette into the collective mapping
102
- $multi-color-palette: map-merge($multi-color-palette, $new-palette);
103
- }
104
-
105
- @return $multi-color-palette;
106
- }
107
-
108
- // ? Multiple Colour's Trio Palette
109
- // a function to loop through a map of colours and create trio shade palettes for them all and collect this into a single map
110
-
111
- @function multi-color-tri-palette($color-map) {
112
- $multi-color-trio: ();
113
-
114
- @each $key, $base_color in $color-map {
115
- // create a palette for a single colour from the providing mapping
116
- $new-trio: single-color-tri-palette($key, $base_color);
117
-
118
- // merge the colours shade palette into the collective mapping
119
- $multi-color-trio: map-merge($multi-color-trio, $new-trio);
120
- }
121
-
122
- @return $multi-color-trio;
123
- }
@@ -1,7 +0,0 @@
1
- @function light-index($color) {
2
- @return math.floor(math.div(lightness($color), 10%));
3
- }
4
-
5
- @function palette-index($color) {
6
- @return 9 - light-index($color);
7
- }
@@ -1,17 +0,0 @@
1
- $_uc-brightness-step: 9%;
2
- $_uc-saturation-step: 2%;
3
-
4
- // ? HSL Sequence
5
- // Equally spaces colours from 50, 100 to 900 by only adjusting saturation and lightness
6
-
7
- @function hsl_sequence($color, $step, $lighter) {
8
- @if $lighter {
9
- $color: lighten($color, $step * $_uc-brightness-step);
10
- $color: desaturate($color, $step * $_uc-saturation-step);
11
- } @else {
12
- $color: darken($color, $step * $_uc-brightness-step);
13
- $color: saturate($color, $step * $_uc-saturation-step);
14
- }
15
-
16
- @return $color;
17
- }
@@ -1,60 +0,0 @@
1
- // * Advanced Classes
2
-
3
- @mixin breakpoint-up($size) {
4
- @media only screen and (min-width: #{$size - 1}) {
5
- @content;
6
- }
7
- }
8
-
9
- // 'md|color--red-400'
10
- // 'hover|color--red-400'
11
- // 'hover|md|color--red-400'
12
-
13
- @mixin advanced-classes($class) {
14
- .#{$class} {
15
- @content;
16
- }
17
-
18
- @if map.get($_uc_user_utility_colors, config, breakpoint) == true and map.get($_uc_user_utility_colors, config, pseudo) == true {
19
- @each $initial, $screen-size in $_uc-screen-sizes {
20
- @each $pseudo in $_uc-pseudos {
21
- .#{$pseudo}\|#{$initial}\|#{$class}:#{$pseudo} {
22
- @include breakpoint-up($screen-size) {
23
- @content;
24
- }
25
- }
26
- }
27
- }
28
- }
29
-
30
- @if map.get($_uc_user_utility_colors, config, breakpoint) == true {
31
- @each $initial, $screen-size in $_uc-screen-sizes {
32
- .#{$initial}\|#{$class} {
33
- @include breakpoint-up($screen-size) {
34
- @content;
35
- }
36
- }
37
- }
38
- }
39
-
40
- @if map.get($_uc_user_utility_colors, config, pseudo) == true {
41
- @each $pseudo in $_uc-pseudos {
42
- .#{$pseudo}\|#{$class}:#{$pseudo} {
43
- @content;
44
- }
45
- }
46
- }
47
- }
48
-
49
-
50
- // ? Map Classes
51
-
52
- // -|sm|md|lg|xl
53
- // @include map-simple-classes($map, "class", "style");
54
- @mixin map-simple-classes($map, $class-prop, $style-prop) {
55
- @each $key, $var in $map {
56
- @include advanced-classes("#{$class-prop}--#{$key}") {
57
- #{$style-prop}: $var
58
- }
59
- }
60
- }
@@ -1,22 +0,0 @@
1
- // * Colors
2
-
3
- @if map.get($_uc_user_utility_colors, config, classes) {
4
- @include advanced-classes("color--current") { color: currentColor; }
5
-
6
- // ? Colors
7
- @include map-simple-classes($_uc-all-colors, "color", "color"); // .color--red-100
8
-
9
- // ? Background Colors
10
- @include map-simple-classes($_uc-all-colors, "bg", "background-color"); // .bg--red-100
11
-
12
- // ? Border Colors
13
- @include map-simple-classes($_uc-all-colors, "border-c", "border-color"); // .border-c--red-100
14
-
15
- // ? Outline Colors
16
- @include map-simple-classes($_uc-all-colors, "outline-c", "outline-color"); // .outline-c--red-100
17
-
18
- // ? Text Decoration Colors
19
- @include map-simple-classes($_uc-all-colors, "decoration-c", "text-decoration-color"); // .decoration-c--red-100
20
- }
21
-
22
-
@@ -1,3 +0,0 @@
1
- // @if variable-exists("utility_colors") == false {
2
- // @warn 'Without the utility colors you may forget about future configuration';
3
- // }
@@ -1,64 +0,0 @@
1
- // * Color Palettes
2
-
3
- $_uc-shades-use-colors: (
4
- 'red': hsl(2, 78%, 64%),
5
- 'rust': hsl(16, 82%, 62%),
6
- 'orange': hsl(31, 90%, 65%),
7
- 'gold': hsl(46, 93%, 54%),
8
- 'yellow': hsl(58, 87%, 55%),
9
- 'pear': hsl(80, 74%, 57%),
10
- 'green': hsl(110, 69%, 58%),
11
- 'seaside': hsl(156, 78%, 57%),
12
- 'cyan': hsl(180, 69%, 37%),
13
- 'capri': hsl(197, 90%, 46%),
14
- 'blue': hsl(214, 78%, 36%),
15
- 'iris': hsl(265, 87%, 57%),
16
- 'purple': hsl(279, 85%, 56%),
17
- 'magenta': hsl(300, 64%, 66%),
18
- 'pink': hsl(320, 74%, 66%),
19
- 'satin': hsl(348, 74%, 57%),
20
- 'cement': hsl(42, 6%, 87%),
21
- 'grey': hsl(0, 3%, 46%),
22
- 'base': hsl(0, 3%, 46%),
23
- );
24
-
25
- $_uc-shades-use-palette: multi-color-shades-palette($_uc-shades-use-colors);
26
-
27
- $_uc-all-colors: map-combine(
28
- $_uc-shades-use-colors,
29
- $_uc-shades-use-palette,
30
- );
31
-
32
- @function get-uc($color-name) {
33
- @if map-has-key($_uc-all-colors, #{$color-name}) {
34
- @return map.get($_uc-all-colors, #{$color-name});
35
- } @else {
36
- @error "ERROR: Couldn't find Color";
37
- }
38
- };
39
-
40
- $_uc-tri-use-colors: (
41
- success: get-uc(green-400),
42
- danger: get-uc(red-400),
43
- information: get-uc(blue-400),
44
- warning: get-uc(gold-400),
45
- );
46
-
47
- $_uc-tri-use-palette: multi-color-tri-palette($_uc-tri-use-colors);
48
-
49
- $_uc-all-colors: map-combine(
50
- $_uc-all-colors,
51
- $_uc-tri-use-palette,
52
- );
53
-
54
- $_uc-single-use-colors: (
55
- 'white': #fff,
56
- 'black': #000,
57
- translucent: rgba(#000, 0.45),
58
- );
59
-
60
- $_uc-all-colors: map-combine(
61
- $_uc-all-colors,
62
- $_uc-single-use-colors,
63
- );
64
-
@@ -1,53 +0,0 @@
1
- $_uc-screen-sizes: (
2
- sm: 325px,
3
- md: 768px,
4
- lg: 1024px,
5
- xl: 1440px,
6
- );
7
-
8
- $_uc-pseudo-input: (
9
- checked,
10
- disabled,
11
- enabled,
12
- focus,
13
- );
14
-
15
- $_uc-pseudo-input-extra: (
16
- in-range,
17
- invalid,
18
- optional,
19
- out-of-range,
20
- read-only,
21
- read-write,
22
- require,
23
- valid
24
- );
25
-
26
- $_uc-pseudo-action: (
27
- active,
28
- hover,
29
- link,
30
- target,
31
- visited
32
- );
33
-
34
- $_uc-pseudo-child: (
35
- root,
36
- first-child,
37
- first-of-type,
38
- last-child,
39
- last-of-type,
40
- only-of-type,
41
- only-child,
42
- empty
43
- // nth-child(n),
44
- // nth-last-child(n),
45
- // nth-last-of-type(n),
46
- // nth-of-type(n),
47
- );
48
-
49
- $_uc-pseudos: list-combine(
50
- $_uc-pseudo-input,
51
- $_uc-pseudo-action,
52
- $_uc-pseudo-child
53
- );
@@ -1,78 +0,0 @@
1
- // * User Color Palettes
2
-
3
- $_default_utility_colors: (
4
- config: (
5
- classes: true,
6
- breakpoint: true,
7
- pseudo: true,
8
- defaults: true,
9
- syntax: 'BEM',
10
- ),
11
- colors: (
12
- shades-use: (
13
-
14
- ),
15
- tri-use: (
16
-
17
- ),
18
- single-use: (
19
-
20
- ),
21
- )
22
- );
23
-
24
- $_uc_user_utility_colors: ();
25
- $_uc_user_config: ();
26
- $_uc_user_colors: ();
27
-
28
- @if variable-exists(utility_colors) {
29
- @if map.get($utility_colors, config) != null {
30
- $_uc_user_config: map.merge(map.get($_default_utility_colors, config), map.get($utility_colors, config));
31
- @if map.get($_uc_user_utility_colors, config, defaults) == false { $_uc-all-colors: (); }
32
- } @else {
33
- $_uc_user_config: map.get($_default_utility_colors, config);
34
- }
35
-
36
- @if map.get($utility_colors, colors) != null {
37
- $_uc_user_colors: map.merge(map.get($_default_utility_colors, colors), map.get($utility_colors, colors));
38
- } @else {
39
- $_uc_user_colors: map.get($_default_utility_colors, colors);
40
- }
41
-
42
- $_uc_user_utility_colors: (
43
- config: $_uc_user_config,
44
- colors: $_uc_user_colors,
45
- );
46
-
47
- @if map.get($_uc_user_utility_colors, colors, shades-use) != null {
48
- $_uc-user-shades-use-colors: map.get($_uc_user_utility_colors, colors, shades-use);
49
- $_uc-user-shades-use-palette: multi-color-shades-palette($_uc-user-shades-use-colors);
50
-
51
- $_uc-all-colors: map-combine(
52
- $_uc-all-colors,
53
- $_uc-user-shades-use-colors,
54
- $_uc-user-shades-use-palette,
55
- );
56
- }
57
-
58
- @if map.get($_uc_user_utility_colors, colors, tri-use) != null {
59
- $_uc-user-tri-use-colors: map.get($_uc_user_utility_colors, colors, tri-use);
60
- $_uc-user-tri-use-palette: multi-color-tri-palette($_uc-user-tri-use-colors);
61
-
62
- $_uc-all-colors: map-combine(
63
- $_uc-all-colors,
64
- $_uc-user-tri-use-palette,
65
- );
66
- }
67
-
68
- @if map.get($_uc_user_utility_colors, colors, single-use) != null {
69
- $_uc-user-single-use-colors: map.get($_uc_user_utility_colors, colors, single-use);
70
-
71
- $_uc-all-colors: map-combine(
72
- $_uc-all-colors,
73
- $_uc-user-single-use-colors,
74
- );
75
- }
76
- } @else {
77
- $_uc_user_utility_colors: $_default_utility_colors;
78
- }
@@ -1,3 +0,0 @@
1
- @import 'mod-variables';
2
- @import 'color-variables';
3
- @import 'user-variables';