Skip to content

Commit

Permalink
fix: Pass the background color correctly before passing to adjust fun…
Browse files Browse the repository at this point in the history
…citon
  • Loading branch information
aileenvl committed Jan 6, 2025
1 parent 71a5ece commit 473ce22
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions packages/ui-stencil/extract-scss-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
}
}
},
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 473ce22

Please sign in to comment.