Skip to content

Commit

Permalink
feat(color.name-indicator-remove()): remove indicator or multiple ind…
Browse files Browse the repository at this point in the history
…icators from color name.
  • Loading branch information
sciborrudnicki committed Jan 2, 2024
1 parent b5679c6 commit ce0cdc4
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions color/name/indicator/_indicator.remove.function.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Sass.
@use 'sass:list';
@use 'sass:map';

// Functions.
@use '../../../list/list.indexes.function' as list-indexes;
@use '../../../list/list.nth.function' as list-nth;
@use '../../../list/remove/remove.nth.function' as list-remove-nth;
@use '../adjustment/adjustment.has.function';

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

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

// multiple
// @debug remove(primary dark ':color', ':color', ':background'); // primary dark
// @debug remove(primary dark ':color', ':'); // primary dark

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

0 comments on commit ce0cdc4

Please sign in to comment.