Skip to content

Commit

Permalink
fix(color.theme-build()): change the way of build theme to use color-…
Browse files Browse the repository at this point in the history
…scheme or theme name. Update spec.
  • Loading branch information
sciborrudnicki committed Nov 25, 2023
1 parent 9e5f583 commit 48e2bf8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 11 additions & 5 deletions color/theme/_theme.build.function.scss
@@ -1,11 +1,13 @@
// Sass.
@use 'sass:list';
@use 'sass:map';

// Modules.
@use '../../map';
@use '../../string';
@use '../palette';

// Functions.
@use '../../list/list.range.function' as *;
@use 'theme.pick.function' as *;

// Status: DONE
Expand All @@ -18,13 +20,17 @@
@if type-of($theme) == map {
@if list.length($pick) > 0 {
@each $pick in $pick {
@each $name, $palette in pick($theme, $pick) {
$result: map.deep-merge($result, palette.create(($name: $palette)));
@each $theme, $palettes in pick($theme, $pick) {
@each $name, $variant in $palettes {
$result: map.deep-merge($result, ($theme: palette.create(($name: $variant))));
}
}
}
} @else {
@each $name, $palette in $theme {
$result: map.deep-merge($result, palette.create(($name: $palette)));
@each $theme, $palettes in $theme {
@each $name, $variant in $palettes {
$result: map.deep-merge($result, ($theme: palette.create(($name: $variant))));
}
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions color/theme/_theme.build.function.spec.scss
@@ -1,5 +1,6 @@
// Functions.
@use 'theme.build.function' as *;
@use 'theme.load.mixin' as *;

// Dark theme
$-dark: (
Expand Down Expand Up @@ -195,9 +196,11 @@ $normal: (
)
);

// @debug build($normal, bg);

@debug build($normal, other);

@include load($normal, bg) using($resolved...) {
@debug $resolved;
}

// input data
// [bracketed list] - build color variant
Expand Down

0 comments on commit 48e2bf8

Please sign in to comment.