matcha-theme 1.0.2 → 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.
@@ -1,3 +1,31 @@
1
+ // Saturation Levels
2
+ $saturationLevels: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, A100, A200, A400, A700;
3
+
4
+ // Hues Palette Colors
5
+ $matchaPalettes: (
6
+ "red": $red,
7
+ "pink": $pink,
8
+ "purple": $purple,
9
+ "deep-purple": $deep-purple,
10
+ "indigo": $indigo,
11
+ "blue": $blue,
12
+ "light-blue": $light-blue,
13
+ "cyan": $cyan,
14
+ "teal": $teal,
15
+ "green": $green,
16
+ "light-green": $light-green,
17
+ "lime": $lime,
18
+ "yellow": $yellow,
19
+ "amber": $amber,
20
+ "orange": $orange,
21
+ "deep-orange": $deep-orange,
22
+ "brown": $brown,
23
+ "grey": $grey,
24
+ "blue-grey": $blue-grey
25
+ );
26
+
27
+ // Hues Palette Colors
28
+ $index: 0;
1
29
  // -------------------------------------------------------------------------------------------------------------------
2
30
  // @ Text color levels generator
3
31
  // -------------------------------------------------------------------------------------------------------------------
@@ -42,12 +70,30 @@
42
70
  }
43
71
  }
44
72
  }
73
+ @mixin _generate-classes($prefix, $color-map, $saturation) {
74
+ // .primary-500
75
+ // .primary-600-bg
76
+ // .primary-700-fg
77
+ $background: map-get($color-map, $saturation);
78
+ $contrast: map-get($color-map, #{$saturation}-contrast);
79
+
80
+ .#{$prefix}-#{$saturation} {
81
+ background: $background;
82
+ color: $contrast;
83
+ }
84
+ .#{$prefix}-#{$saturation}-bg {
85
+ background: $background;
86
+ }
87
+ .#{$prefix}-#{$saturation}-fg {
88
+ color: $background;
89
+ }
90
+ }
45
91
 
46
92
  // -------------------------------------------------------------------------------------------------------------------
47
93
  // @ Static color classes generator
48
94
  // -------------------------------------------------------------------------------------------------------------------
49
- @mixin _generate-static-color-classes($colorName, $color, $contrastColor, $hue) {
50
- $colorSelector: unquote(".#{$colorName}#{$hue}");
95
+ @mixin _generate-static-color-classes($colorName, $color, $contrastColor, $saturation) {
96
+ $colorSelector: unquote(".#{$colorName}#{$saturation}");
51
97
 
52
98
  #{$colorSelector}-bg {
53
99
  background-color: $color !important;
@@ -80,25 +126,29 @@
80
126
  }
81
127
  }
82
128
 
83
- @mixin colors-classes-static($palettes) {
129
+ @mixin colors-classes-static($matchaPalettes) {
84
130
  $light-contrasting-classes: ();
85
131
  $dark-contrasting-classes: ();
86
132
 
87
- @each $paletteName, $palette in $palettes {
133
+ @each $paletteName, $palette in $matchaPalettes {
134
+ // $contrasts: map-get($red, "contrast");
135
+ // $contrasts = all contrast colors of $red palette
88
136
  $contrasts: map-get($palette, "contrast");
89
137
 
90
- @each $hue in $matchaHues {
91
- $color: map-get($palette, $hue);
92
- $contrast: map-get($contrasts, $hue);
138
+ @each $saturation in $saturationLevels {
139
+ // $color: map-get($red, 500)
140
+ // $contrast: map-get($contrasts, 500); 500 contrast color of $red palette
141
+ $color: map-get($palette, $saturation);
142
+ $contrast: map-get($contrasts, $saturation);
93
143
 
94
144
  @if ($color != null and $contrast != null) {
95
- @include _generate-static-color-classes($paletteName, $color, $contrast, "-#{$hue}");
145
+ @include _generate-static-color-classes($paletteName, $color, $contrast, "-#{$saturation}");
96
146
 
97
147
  // If the contrast color is dark
98
148
  @if (rgba(black, 1) ==rgba($contrast, 1)) {
99
149
  $dark-contrasting-classes: append(
100
150
  $dark-contrasting-classes,
101
- unquote(".#{$paletteName}-#{$hue}"),
151
+ unquote(".#{$paletteName}-#{$saturation}"),
102
152
  "comma"
103
153
  );
104
154
  }
@@ -107,14 +157,23 @@
107
157
  @else {
108
158
  $light-contrasting-classes: append(
109
159
  $light-contrasting-classes,
110
- unquote(".#{$paletteName}-#{$hue}"),
160
+ unquote(".#{$paletteName}-#{$saturation}"),
111
161
  "comma"
112
162
  );
113
163
  }
114
164
 
115
165
  // Run the generator one more time for default values (500)
116
166
  // if we are not working with primary, accent or warn palettes
117
- @if ($hue ==500 and $paletteName != "primary" and $paletteName != "accent" and $paletteName != "warn") {
167
+ @if (
168
+ $saturation
169
+ ==500 and
170
+ $paletteName !=
171
+ "primary" and
172
+ $paletteName !=
173
+ "accent" and
174
+ $paletteName !=
175
+ "warn"
176
+ ) {
118
177
  // Generate color classes
119
178
  @include _generate-static-color-classes($paletteName, $color, $contrast, "");
120
179
 
@@ -140,33 +199,6 @@
140
199
  }
141
200
  }
142
201
  }
143
-
144
- // Run the generator again for the selected default hue values for
145
- // primary, accent and warn palettes
146
- //
147
- // We are doing this because the default hue value can be changed
148
- // by the user when the Material theme being generated.
149
- @if ($paletteName == "primary" or $paletteName == "accent" or $paletteName == "warn") {
150
- // Get the color and the contrasting color for the selected
151
- // default hue
152
- $color: map-get($palette, "default");
153
- $contrast: map-get($palette, "default-contrast");
154
-
155
- // Generate color classes
156
- @include _generate-static-color-classes($paletteName, $color, $contrast, "");
157
-
158
- // Add color to the correct list depending on the contrasting color
159
-
160
- // If the contrast color is dark
161
- @if (rgba(black, 1) ==rgba($contrast, 1)) {
162
- $dark-contrasting-classes: append($dark-contrasting-classes, unquote(".#{$paletteName}"), "comma");
163
- }
164
-
165
- // if the contrast color is light
166
- @else {
167
- $light-contrasting-classes: append($light-contrasting-classes, unquote(".#{$paletteName}"), "comma");
168
- }
169
- }
170
202
  }
171
203
 
172
204
  // Generate contrasting colors
@@ -174,32 +206,35 @@
174
206
  @include _generate-text-color-levels($light-contrasting-classes, "light");
175
207
  }
176
208
 
209
+ @include colors-classes-static($matchaPalettes);
177
210
  // -------------------------------------------------------------------------------------------------------------------
178
211
  // @ Dynamic color classes generator
179
212
  // -------------------------------------------------------------------------------------------------------------------
180
213
  @mixin _generate-dynamic-color-classes($attribute, $colorLevel, $colorName, $background, $foreground) {
181
214
  $color: unquote("-#{$colorName}");
182
- $selectors: (".#{$attribute}#{$color}", ".matcha-#{$attribute}#{$color}", ".matcha-#{$attribute}-graphic#{$color}");
215
+ $selector: ".#{$attribute}#{$color}"; // .background-yellow
216
+ $baseClassName: (".base-#{$colorName}"); // .base-yellow
183
217
 
184
- @each $selector in $selectors {
185
- #{$selector} {
186
- #{$attribute}: map-get($colorLevel, $colorName) !important;
218
+ #{$selector} {
219
+ #{$attribute}: map-get($colorLevel, $colorName) !important;
220
+ &-alpha {
221
+ background: map-get($colorLevel, ("#{$colorName}-alpha")) !important;
222
+ }
223
+ }
187
224
 
188
- &-alpha {
189
- #{$attribute}: map-get($colorLevel, ("#{$colorName}-alpha")) !important;
190
- }
225
+ #{$baseClassName} {
226
+ &-alpha {
227
+ background: map-get($colorLevel, ("#{$colorName}-alpha")) !important;
191
228
  }
192
229
  }
193
230
 
194
231
  @if ($colorName != yellow or $colorName != amber) {
195
- $baseClassName: (".base-#{$colorName}");
196
232
  #{$baseClassName} {
197
233
  background: map-get($background, $colorName);
198
234
  color: map-get($foreground, text-inverse);
199
235
  }
200
236
  }
201
237
  @if ($colorName == yellow or $colorName == amber) {
202
- $baseClassName: (".base-#{$colorName}");
203
238
  #{$baseClassName} {
204
239
  background: map-get($background, $colorName);
205
240
  color: map-get($foreground, static-dark-text);
@@ -207,22 +242,6 @@
207
242
  }
208
243
  }
209
244
 
210
- @mixin _generate-classes($prefix, $color-map, $saturation) {
211
- $background: map-get($color-map, $saturation);
212
- $contrast: map-get($color-map, #{$saturation}-contrast);
213
-
214
- .#{$prefix}-#{$saturation} {
215
- background: $background;
216
- color: $contrast;
217
- }
218
- .#{$prefix}-#{$saturation}-bg {
219
- background: $background;
220
- }
221
- .#{$prefix}-#{$saturation}-fg {
222
- color: $background;
223
- }
224
- }
225
-
226
245
  @mixin colors-classes-dynamic($theme) {
227
246
  $is-dark: map-get($theme, isdark);
228
247
  $primary: map-get($theme, primary);
@@ -231,6 +250,11 @@
231
250
  $background: map-get($theme, background);
232
251
  $foreground: map-get($theme, foreground);
233
252
 
253
+ $themePalette: (
254
+ "primary": $primary,
255
+ "accent": $accent,
256
+ "warn": $warn
257
+ );
234
258
  $colorNames: red, pink, purple, deep-purple, indigo, blue, light-blue, cyan, teal, green, light-green, lime, yellow,
235
259
  amber, orange, deep-orange, primary, accent, warn;
236
260
  $attributes: (
@@ -241,28 +265,55 @@
241
265
  stroke: $background
242
266
  );
243
267
 
244
- .primary,
245
- .base-primary {
246
- background: map-get($primary, default);
247
- color: map-get($primary, default-contrast);
268
+ @each $saturation in $saturationLevels {
269
+ // generate classes for all saturation levels of primary, accent and warn palettes
270
+ @include _generate-classes("primary", $primary, $saturation);
271
+ @include _generate-classes("accent", $accent, $saturation);
272
+ @include _generate-classes("warn", $warn, $saturation);
248
273
  }
249
274
 
250
- .accent,
251
- .base-accent {
252
- background: map-get($accent, default);
253
- color: map-get($accent, default-contrast);
275
+ @each $paletteName, $palette in $themePalette {
276
+ // generate
277
+ .tapibaquifrafo {
278
+ background: red;
279
+ }
280
+ .base-#{$paletteName},
281
+ .#{$paletteName} {
282
+ background: map-get($palette, default);
283
+ color: map-get($palette, default-contrast);
284
+ }
285
+ .#{$paletteName}-bg {
286
+ background: map-get($palette, default) !important;
287
+ }
288
+ .#{$paletteName}-fg {
289
+ color: map-get($palette, default) !important;
290
+ }
291
+ .background-#{$paletteName}-alpha,
292
+ .base-#{$paletteName}-alpha {
293
+ background: rgba(map-get($palette, default), 0.2);
294
+ }
254
295
  }
255
296
 
256
- .warn,
257
- .base-warn {
258
- background: map-get($warn, default);
259
- color: map-get($warn, default-contrast);
297
+ .base-surface {
298
+ background: map-get($background, card);
299
+ color: map-get($foreground, text);
300
+ &-alpha {
301
+ background: rgba(map-get($background, card), 0.5) !important;
302
+ }
260
303
  }
261
-
262
- @each $saturation in $matchaHues {
263
- @include _generate-classes("primary", $primary, $saturation);
264
- @include _generate-classes("accent", $accent, $saturation);
265
- @include _generate-classes("warn", $warn, $saturation);
304
+ .base-fg {
305
+ background: map-get($foreground, text);
306
+ color: map-get($foreground, text-inverse);
307
+ &-alpha {
308
+ background: rgba(map-get($foreground, text), 0.2) !important;
309
+ }
310
+ }
311
+ .base-bg {
312
+ background: map-get($background, background);
313
+ color: map-get($foreground, text);
314
+ &-alpha {
315
+ background: rgba(map-get($background, background), 0.5) !important;
316
+ }
266
317
  }
267
318
 
268
319
  .background-transparent,
@@ -295,123 +346,73 @@
295
346
  #{$attribute}: map-get($background, card-alpha-inverse) !important;
296
347
  }
297
348
  }
298
-
299
- .primary-bg {
300
- background: map-get($primary, default) !important;
301
- }
302
- .primary-fg {
303
- color: map-get($primary, default) !important;
304
- }
305
- .background-primary-alpha {
306
- background: rgba(map-get($primary, default), 0.2);
307
- }
308
- .accent-bg {
309
- background: map-get($accent, default) !important;
310
- }
311
- .accent-fg {
312
- color: map-get($accent, default) !important;
313
- }
314
- .background-accent-alpha {
315
- background: rgba(map-get($accent, default), 0.2);
316
- }
317
-
318
- .warn-bg {
319
- background: map-get($warn, default) !important;
320
- }
321
- .warn-fg {
322
- color: map-get($warn, default) !important;
323
- }
324
- .background-warn-alpha {
325
- background: rgba(map-get($warn, default), 0.2);
326
- }
327
-
328
- .#{$attribute}-primary,
329
- .matcha-#{$attribute}-primary {
349
+ .#{$attribute}-primary {
330
350
  #{$attribute}: map-get($primary, default) !important;
331
351
  }
332
352
 
333
- .#{$attribute}-accent,
334
- .matcha-#{$attribute}-accent {
353
+ .#{$attribute}-accent {
335
354
  #{$attribute}: map-get($accent, default) !important;
336
355
  }
337
356
 
338
- .#{$attribute}-warn,
339
- .matcha-#{$attribute}-warn {
357
+ .#{$attribute}-warn {
340
358
  #{$attribute}: map-get($warn, default) !important;
341
359
  }
342
360
 
343
- .#{$attribute}-error,
344
- .matcha-#{$attribute}-error {
361
+ .#{$attribute}-error {
345
362
  #{$attribute}: map-get($background, error) !important;
346
363
  }
347
364
 
348
- .#{$attribute}-info,
349
- .matcha-#{$attribute}-info {
365
+ .#{$attribute}-info {
350
366
  #{$attribute}: map-get($background, info) !important;
351
367
  }
352
368
 
353
- .#{$attribute}-success,
354
- .matcha-#{$attribute}-success {
369
+ .#{$attribute}-success {
355
370
  #{$attribute}: map-get($background, success) !important;
356
371
  }
357
372
 
358
- .#{$attribute}-warning,
359
- .matcha-#{$attribute}-warning {
373
+ .#{$attribute}-warning {
360
374
  #{$attribute}: map-get($background, warning) !important;
361
375
  }
362
376
 
363
377
  .#{$attribute}-foreground,
364
378
  .#{$attribute}-fg,
365
379
  .#{$attribute}-base,
366
- .#{$attribute}-text,
367
- .matcha-#{$attribute}-foreground,
368
- .matcha-#{$attribute}-fg,
369
- .matcha-#{$attribute}-base,
370
- .matcha-#{$attribute}-text {
380
+ .#{$attribute}-text {
371
381
  #{$attribute}: map-get($foreground, text) !important;
372
382
  }
373
383
 
374
384
  .#{$attribute}-fg-inverse,
375
385
  .#{$attribute}-base-inverse,
376
- .matcha-#{$attribute}-text-inverse {
386
+ .#{$attribute}-text-inverse {
377
387
  #{$attribute}: map-get($foreground, text-inverse) !important;
378
388
  }
379
389
 
380
- .#{$attribute}-surface,
381
- .matcha-#{$attribute}-dialog,
382
- .matcha-#{$attribute}-card {
390
+ .#{$attribute}-surface {
383
391
  #{$attribute}: map-get($background, card) !important;
384
392
  }
385
393
 
386
- .#{$attribute}-surface-alpha,
387
- .matcha-#{$attribute}-surface-alpha,
388
- .matcha-#{$attribute}-card-alpha {
394
+ .#{$attribute}-surface-alpha {
389
395
  #{$attribute}: map-get($background, card-alpha) !important;
390
396
  }
391
397
 
392
398
  .#{$attribute}-hover,
393
- .matcha-#{$attribute}-hover,
394
- .matcha-#{$attribute}-placeholder {
399
+ .#{$attribute}-placeholder {
395
400
  #{$attribute}: map-get($foreground, placeholder) !important;
396
401
  }
397
402
 
398
- .#{$attribute}-label,
399
- .matcha-#{$attribute}-label {
403
+ .#{$attribute}-label {
400
404
  #{$attribute}: map-get($foreground, label) !important;
401
405
  }
402
406
 
403
- .#{$attribute}-disabled,
404
- .matcha-#{$attribute}-disabled {
407
+ .#{$attribute}-disabled {
405
408
  #{$attribute}: map-get($background, disabled) !important;
406
409
  }
407
410
 
408
- .#{$attribute}-disabled-icon,
409
- .matcha-#{$attribute}-disabled-icon {
411
+ .#{$attribute}-disabled-icon {
410
412
  #{$attribute}: map-get($foreground, disabled-icon) !important;
411
413
  }
412
414
 
413
- .#{$attribute}-selected,
414
- .matcha-#{$attribute}-selected {
415
+ .#{$attribute}-selected {
415
416
  #{$attribute}: map-get($background, selected-button) !important;
416
417
  }
417
418