0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
penpot-exporter-figma-plugin/ui-src/translators/translateUiBlendMode.ts
Alex Sánchez dddc457281
Images (#89)
* wip

* wip

* fix something?

* wip

* wip

* wip

* fixes

* fixes

* stroke image

* wip

* fixes

* fixes

* remove old code

* fix translate fills

* remove penpot public uri

* remove old code

* fix return undefineds

* updated packages

* finish refactor

---------

Co-authored-by: Jordi Sala Morales <jordism91@gmail.com>
2024-05-09 16:59:27 +02:00

60 lines
1.5 KiB
TypeScript

import {
BLEND_MODE_COLOR,
BLEND_MODE_COLOR_BURN,
BLEND_MODE_COLOR_DODGE,
BLEND_MODE_DARKEN,
BLEND_MODE_DIFFERENCE,
BLEND_MODE_EXCLUSION,
BLEND_MODE_HARD_LIGHT,
BLEND_MODE_HUE,
BLEND_MODE_LIGHTEN,
BLEND_MODE_LUMINOSITY,
BLEND_MODE_MULTIPLY,
BLEND_MODE_NORMAL,
BLEND_MODE_OVERLAY,
BLEND_MODE_SATURATION,
BLEND_MODE_SCREEN,
BLEND_MODE_SOFT_LIGHT,
BlendMode
} from '@ui/lib/types/utils/blendModes';
export const translateUiBlendMode = (blendMode?: BlendMode): BlendMode | undefined => {
if (!blendMode) return;
switch (blendMode) {
case 'normal':
return BLEND_MODE_NORMAL;
case 'darken':
return BLEND_MODE_DARKEN;
case 'multiply':
return BLEND_MODE_MULTIPLY;
case 'color-burn':
return BLEND_MODE_COLOR_BURN;
case 'lighten':
return BLEND_MODE_LIGHTEN;
case 'screen':
return BLEND_MODE_SCREEN;
case 'color-dodge':
return BLEND_MODE_COLOR_DODGE;
case 'overlay':
return BLEND_MODE_OVERLAY;
case 'soft-light':
return BLEND_MODE_SOFT_LIGHT;
case 'hard-light':
return BLEND_MODE_HARD_LIGHT;
case 'difference':
return BLEND_MODE_DIFFERENCE;
case 'exclusion':
return BLEND_MODE_EXCLUSION;
case 'hue':
return BLEND_MODE_HUE;
case 'saturation':
return BLEND_MODE_SATURATION;
case 'color':
return BLEND_MODE_COLOR;
case 'luminosity':
return BLEND_MODE_LUMINOSITY;
default:
return BLEND_MODE_NORMAL;
}
};