Skip to content

Commit 7ca383a

Browse files
feat(color.name-update()): add function to update name especially with adjustment.
1 parent eded752 commit 7ca383a

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

color/name/_name.update.function.scss

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Sass.
2+
@use 'sass:list';
3+
@use 'sass:map';
4+
5+
// Variables.
6+
@use '../../var/var.variables' as variables;
7+
8+
// Modules.
9+
@use 'adjustment';
10+
11+
// Module functions.
12+
@use 'name.create.function' as *;
13+
14+
// Status: DONE
15+
// The `color.name-update()` function updates color name with `color` indicator and `$shade`.
16+
// @param `$name`
17+
// @param `$update`
18+
// @param `$type`
19+
// @param `$delimiter`
20+
// @param `$shade` (dark, light)
21+
// @returns
22+
@function update(
23+
$name,
24+
$update,
25+
$type,
26+
$delimiter: map.get(variables.$var, delimiter),
27+
$shade: (dark, light),
28+
) {
29+
@return if(
30+
adjustment.has($name),
31+
list.set-nth($name, 1, create($update, $type, $delimiter, $shade)),
32+
create($update, $type, $delimiter, $shade)
33+
);
34+
}
35+
36+
// Examples.
37+
// @debug update(primary, secondary light, lightness); // secondary color light lightness
38+
// @debug update(primary dark, secondary light, lightness); // secondary color light lightness
39+
40+
// adjustment
41+
// @debug update((primary,) 15% 0.1, secondary light, lightness); // (secondary color light lightness) 15% 0.1
42+
43+
// comma adjustment
44+
// @debug update((primary dark) 15% 0.1, secondary light, lightness); // (secondary color light lightness) 15% 0.1
45+
// @debug update((primary dark, 15deg, 15%, 0.1), secondary light, lightness); // secondary color light lightness, 15deg, 15%, 0.1

0 commit comments

Comments
 (0)