Skip to content

Commit

Permalink
feat(color.name-indicator-retrieve()): retrieve indicator or multiple…
Browse files Browse the repository at this point in the history
… indicators from color name.
  • Loading branch information
sciborrudnicki committed Jan 2, 2024
1 parent d853f93 commit b5679c6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions color/name/indicator/_indicator.retrieve.function.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Functions.
@use '../../../list/list.indexes.function' as list-indexes;
@use '../../../list/list.nth.function' as list-nth;
@use '../adjustment/adjustment.has.function';

// Status: DONE
// The `color.indicator-retrieve()` function.
// @param `$color`
// @param `$indicator`
// @arbitrary `$indicators...`
// @returns
@function retrieve($color, $indicator, $indicators...) {
$color: if(adjustment.has($color), list-nth.nth($color, 1), $color);
@return list-nth.nth(
$color,
list-indexes.indexes($color, all, '~=', $indicator, $indicators...)...
);
}

// Examples.
// @debug retrieve(primary dark ':background', ':'); // :background
// @debug retrieve(primary dark ':color', ':'); // :color

// multiple
// @debug retrieve(primary dark '!test' ':color', ':', '!'); // '":color" "!test"

// adjustment
// @debug retrieve((primary dark ':color', 5%), ':'); // :color

0 comments on commit b5679c6

Please sign in to comment.