From f1c517da618ba92e537e8e4856203fe988df8636 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Mon, 24 Jun 2024 17:07:19 +0200 Subject: Update --- src/_functions.scss | 64 +++++------------------------------------------------ 1 file changed, 6 insertions(+), 58 deletions(-) (limited to 'src/_functions.scss') diff --git a/src/_functions.scss b/src/_functions.scss index 9c29285..0c04f1d 100644 --- a/src/_functions.scss +++ b/src/_functions.scss @@ -67,63 +67,11 @@ @return list.nth(blend-convert.lin_sRGB_to_XYZ(blend-convert.lin_sRGB(blend-convert.sassToRgb($color))), 2) + .05; } -@function palette-old($base-color, $contrasts, $chroma-range: 1, $reference-color: $base-color) { - $chroma-range: 1 - $chroma-range; - - $palette: (); - - @if list.nth(list.nth($contrasts, 1), 2) > list.nth(list.nth($contrasts, list.length($contrasts)), 2) { - $contrasts: iro.fn-list-reverse($contrasts); - } - - $reference-lightness: blend.lightness($reference-color); - $i: 0; - - @while $i <= 1 { - $l: $i * 200% - 100%; - $c: 0%; - - @if $chroma-range != 0 { - $c: $i * 2 - 1; - $c: if( - $reference-lightness >= 50%, - math.clamp(0, $c, 1), - math.clamp(0, -1 * $c, 1) - ); - $c: $chroma-range * $c * -100%; - } - - $palette: list.append($palette, blend.scale($base-color, $l: $l, $c: $c)); - - $i: $i + config.$palette-precision; - } - - $palette: multi-contrast($base-color, $palette, $contrasts, $reference-color); - - @each $key, $color in $palette { - $palette: map.set($palette, #{$key}-text, blend.contrast($color)) - } - - @return $palette; -} - @function palette($base-color, $contrasts, $chroma-range: 1, $reference-color: $base-color) { - $base-lch: blend-convert.Lab_to_LCH( - iro-colors.lin_sRGB_to_Oklab( - blend-convert.lin_sRGB( - blend-convert.sassToRgb($base-color) - ) - ) - ); - $ref-lch: blend-convert.Lab_to_LCH( - iro-colors.lin_sRGB_to_Oklab( - blend-convert.lin_sRGB( - blend-convert.sassToRgb($reference-color) - ) - ) - ); - $ref-l: list.nth($ref-lch, 1); - $ref-y: iro-colors.apca_sRGB_to_Y($reference-color); + $base-lch: iro-colors.parse-oklch($base-color); + $ref-lch: iro-colors.parse-oklch($reference-color); + $ref-l: list.nth($ref-lch, 1); + $ref-y: iro-colors.apca_sRGB_to_Y($reference-color); $cmax: math.max(map.values($contrasts)...); $cmax: math.max($cmax, math.abs(math.min(map.values($contrasts)...))); @@ -131,10 +79,10 @@ $black-y: iro-colors.apca_sRGB_to_Y(#000); $white-y: iro-colors.apca_sRGB_to_Y(#fff); - $palette: (); - $chroma-easing: meta.get-function(config.$palette-chroma-easing, $module: easing); + $palette: (); + @each $key, $contrast in $contrasts { //$i: math.div(list.length($palette), 2 * (list.length($contrasts) - 1)); $y: iro-colors.apcaReverse($contrast, $ref-y); -- cgit v1.2.3-54-g00ecf