-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(color/name): add
color.name-create()
function to create color …
…name with `color` indicator.
- Loading branch information
1 parent
653b1b5
commit 2897f63
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Variables. | ||
@use '../../../var/var.variables' as variables; | ||
|
||
// Modules. | ||
@use '../../../list'; | ||
@use '../../../map'; | ||
@use '../../../string'; | ||
|
||
// Functions. | ||
@use 'name.add-indicator.function' as *; | ||
|
||
// Status: DONE | ||
// The `color.name-create()` function creates color name with `color` indicator and `$shade`. | ||
// @param `$name` | ||
// @param `$type` | ||
// @param `$delimiter` | ||
// @param `$shade` (dark, light) | ||
// @returns | ||
@function create( | ||
$name, | ||
$type, | ||
$delimiter: map.get(variables.$var, delimiter), | ||
$shade: (dark, light), | ||
) { | ||
// Remove `$delimiter` if `$name` is `string` type. | ||
@if type-of($name) == string { | ||
$name: if($delimiter and string.length($delimiter) > 0, string.split($name, $delimiter), ($name,)); | ||
$name: list.join((), $name, space); | ||
} | ||
@if type-of($type) == string { | ||
$type: if($delimiter and string.length($delimiter) > 0, string.split($type, $delimiter), ($type,)); | ||
} | ||
|
||
// Add color indicator to `$name`. | ||
$name: add-indicator($name, $shade); | ||
|
||
// Add type to `$name`. | ||
$name: if($type, list.join($name, $type, space), list.join((), $name, space)); | ||
|
||
// Returns. | ||
@return $name; | ||
} | ||
|
||
// Examples. | ||
// @debug create(primary dark, hue); // primary color dark hue | ||
|
||
// @debug create(secondary light dark, saturation); // secondary light color dark saturation | ||
// @debug create(secondary dark light, saturation); // secondary dark color light saturation | ||
|
||
// @debug create(primary-dark, hue, '-'); // primary color dark hue | ||
// @debug create(secondary-dark-light, saturation, '-'); // secondary dark color light saturation | ||
|
||
// @debug create(primary-dark, hue, '-'); |