From 473ce228802fb28cf8c0f1c5c31b4defab953082 Mon Sep 17 00:00:00 2001 From: Aileen Villanueva Date: Mon, 6 Jan 2025 10:48:54 -0600 Subject: [PATCH] fix: Pass the background color correctly before passing to adjust funciton --- packages/ui-stencil/extract-scss-vars.js | 27 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/ui-stencil/extract-scss-vars.js b/packages/ui-stencil/extract-scss-vars.js index f9d3b3e2..a057d91d 100644 --- a/packages/ui-stencil/extract-scss-vars.js +++ b/packages/ui-stencil/extract-scss-vars.js @@ -57,12 +57,16 @@ function compileScss(filePath) { 'background-color($arg1, $arg2)': (args) => { const colorKey = args[0].assertString('arg1') const palette = args[1].assertMap('arg2') - let currentValue = '' for (const [key, value] of palette.contents.entrySeq()) { - const currentKey = key.toString() - if (currentKey === 'background') { - currentValue = value.get(colorKey).toString() - return new sass.SassString(currentValue) + if (key.toString() === 'background') { + const colorValue = value.get(colorKey).toString() + return new sass.SassColor({ + r: parseInt(colorValue.slice(1,3), 16), + g: parseInt(colorValue.slice(3,5), 16), + b: parseInt(colorValue.slice(5,7), 16), + a: 1, + space: 'rgb' + }) } } }, @@ -90,6 +94,19 @@ function compileScss(filePath) { } } }, + 'adjust($color, $kwargs)': (args) => { + const color = args[0] + const kwargs = args[1].assertMap('kwargs') + const alpha = kwargs.get('alpha').assertNumber('alpha') + + return new sass.SassColor({ + r: color.red, + g: color.green, + b: color.blue, + a: color.alpha + alpha.value, + space: 'rgb' + }) + }, }, }) return result.css.toString()