mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
* Run prettier on packages too. * Add the generated files for icons to prettierignore. * Format all files in the packages folder. * Minor fix.
22 lines
600 B
JavaScript
22 lines
600 B
JavaScript
const TinyColor = require('@ctrl/tinycolor')
|
|
|
|
module.exports = {
|
|
type: 'value',
|
|
matcher: function (token) {
|
|
return token.type === 'custom-gradient'
|
|
},
|
|
transformer: function ({ value }) {
|
|
const stopsString = value.stops
|
|
.map((stop) => {
|
|
return `${new TinyColor.TinyColor(stop.color).toRgbString()} ${stop.position * 100}%`
|
|
})
|
|
.join(', ')
|
|
if (value.gradientType === 'linear') {
|
|
return `linear-gradient(${value.rotation}deg, ${stopsString})`
|
|
}
|
|
if (value.gradientType === 'radial') {
|
|
return `radial-gradient(${stopsString})`
|
|
}
|
|
},
|
|
}
|