0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 05:33:02 -05:00

custom gradient

This commit is contained in:
Alex Sánchez 2024-04-15 10:06:19 +02:00
parent f1e6f76c4f
commit b338027e74
No known key found for this signature in database
GPG key ID: 68A95170EEB87E16

View file

@ -1,23 +1,23 @@
import { Fill } from '@ui/lib/types/utils/fill';
// import { translateGradientLinearFill } from './translateGradientLinearFill';
import { translateGradientLinearFill } from './translateGradientLinearFill';
import { translateSolidFill } from './translateSolidFill';
const translateFill = (fill: Paint /*, width: number, height: number*/): Fill | undefined => {
const translateFill = (fill: Paint, width: number, height: number): Fill | undefined => {
switch (fill.type) {
case 'SOLID':
return translateSolidFill(fill);
// case 'GRADIENT_LINEAR':
// return translateGradientLinearFill(fill, width, height);
case 'GRADIENT_LINEAR':
return translateGradientLinearFill(fill, width, height);
}
console.error('Color type ' + fill.type + ' not supported yet');
};
export const translateFills = (
fills: readonly Paint[] | typeof figma.mixed
// width: number,
// height: number
fills: readonly Paint[] | typeof figma.mixed,
width: number,
height: number
): Fill[] => {
// @TODO: think better variable name
// @TODO: make it work with figma.mixed
@ -26,7 +26,7 @@ export const translateFills = (
const penpotFills = [];
for (const fill of fills2) {
const penpotFill = translateFill(fill /*, width, height*/);
const penpotFill = translateFill(fill, width, height);
if (penpotFill) {
penpotFills.unshift(penpotFill);