diff --git a/.changeset/popular-rabbits-itch.md b/.changeset/popular-rabbits-itch.md new file mode 100644 index 000000000..bd3d3021d --- /dev/null +++ b/.changeset/popular-rabbits-itch.md @@ -0,0 +1,5 @@ +--- +"@tokens-studio/figma-plugin": patch +--- + +Fixes an issue where a user is unable to apply a linear gradient fill via a composition token. diff --git a/packages/tokens-studio-for-figma/src/plugin/setColorValuesOnTarget.ts b/packages/tokens-studio-for-figma/src/plugin/setColorValuesOnTarget.ts index cb905c419..1adb3edc1 100644 --- a/packages/tokens-studio-for-figma/src/plugin/setColorValuesOnTarget.ts +++ b/packages/tokens-studio-for-figma/src/plugin/setColorValuesOnTarget.ts @@ -20,7 +20,10 @@ const applyPaintIfNotEqual = (key, existingPaint, newPaint, target) => { }; const getLinearGradientPaint = async (fallbackValue, token) => { - const { gradientStops, gradientTransform } = convertStringToFigmaGradient(fallbackValue); + const gradientString = typeof fallbackValue === 'object' && fallbackValue.fill + ? fallbackValue.fill + : fallbackValue; + const { gradientStops, gradientTransform } = convertStringToFigmaGradient(gradientString); const rawValue = defaultTokenValueRetriever.get(token)?.rawValue; let gradientStopsWithReferences = gradientStops;