Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sass/color/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ $_enhanced-accessibility: false;
/// .my-component-2 {
/// background: color($my-palette, 'primary', 200, .5);
/// }
@function color($palette: null, $color: 'primary', $variant: 500, $opacity: null) {
@function color($palette: null, $color: primary, $variant: 500, $opacity: null) {
$s: #{var(--ig-#{$color}-#{$variant})};
$contrast: if(meta.type-of($variant) == string, string.index($variant, 'contrast'), false);
$_alpha: if($opacity, $opacity, 1);
$_hsl-alpha: hsl(from $s h s l / $_alpha);
$_mix-alpha: color-mix(in oklch, $s #{$_alpha * 100%}, transparent);

@if $palette {
$s: map.get($palette, $color);
$s: map.get($palette, #{$color});
$base: map.get($s, $variant);
$raw: if($contrast, map.get($s, #{$variant}-contrast), map.get($s, #{$variant}-raw));

Expand Down
5 changes: 5 additions & 0 deletions sass/elevations/presets/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
////
/// @package theming
/// @group elevations
////

/// Level 1 - The color used to generate umbra shadows.
/// @type Color
/// @access private
Expand Down
10 changes: 10 additions & 0 deletions test/_color.spec.scss
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,16 @@ $_palette: palette(
$_ref: color(null, primary, 800);

@include assert-equal($_ref, hsl(from var(--ig-primary-800) h s l / 1));

@include assert() {
@include output() {
color: color($_palette, gray, 100);
}

@include contains() {
color: #fafafa;
}
}
}

@include it('should convert a color to a list of HSL values') {
Expand Down
Loading