-
-
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.palette-get()): add updated
get()
to use instead of old …
…get function.
- Loading branch information
1 parent
f31cd3a
commit 72d34cc
Showing
1 changed file
with
23 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,23 @@ | ||
// Functions. | ||
@use '../name/name.index.function'; | ||
|
||
// Status: DONE | ||
// The `palette.get()` function returns palette variant of `$name` or colors from variant `$class`. | ||
// @param `$palette` Color palettes to get variant or variant color. | ||
// @param `$name` Palette name or its part of `string` or `list` type to get from `$palette`. | ||
// @param `$class` Variant class name or its part of `string` or `list` type to get from palette. | ||
// @returns The returned value is palette variants or variant colors . | ||
@function get($palette, $name, $class: null) { | ||
@if $name { | ||
@each $key, $value in $palette { | ||
@if name.index($key, $name) { | ||
@if $class { | ||
@return get($value, $class); | ||
} @else { | ||
@return $value; | ||
} | ||
} | ||
} | ||
} | ||
@return null; | ||
} |