Pull Request Description: Fix Color Modifier Handling in Gradients
Issue
References to colors in gradients currently drop the color modifier, leading to incorrect colors in gradients.
Solution
Abstract the modifier logic used in the ColorTransformer to a method within the ColorValue class. This allows the logic to be shared with the token parser reference resolver, ensuring consistent application of color modifications when that is supplied (as in the Gradient flow).
Changes
New Method in ColorValue Class:
Introduced an applyStudioExtension method using the pre-existing logic nested in ColorTransfomer.transform.
Integration into Token Parsing:
Updated _resolveColorValue and ColorTransformer to utilize the new method for applying extensions.
// Updated _resolveColorValue
final color = ColorValue.maybeParse(reference.value)
?.applyStudioExtension(reference.extensions);
Test Enhancements:
Added test coverage for alpha modifications to a gradient color.
Note
There is a potential improvement by always supplying a nullable extension when parsing ColorValues. However, further investigation of other usage scenarios is recommended before making this change more broadly.
Pull Request Description: Fix Color Modifier Handling in Gradients
Issue
References to colors in gradients currently drop the color modifier, leading to incorrect colors in gradients.
Solution
Abstract the modifier logic used in the
ColorTransformer
to a method within theColorValue
class. This allows the logic to be shared with the token parser reference resolver, ensuring consistent application of color modifications when that is supplied (as in the Gradient flow).Changes
New Method in
ColorValue
Class:applyStudioExtension
method using the pre-existing logic nested in ColorTransfomer.transform.Integration into Token Parsing:
_resolveColorValue
andColorTransformer
to utilize the new method for applying extensions.Test Enhancements:
Note
There is a potential improvement by always supplying a nullable extension when parsing
ColorValues
. However, further investigation of other usage scenarios is recommended before making this change more broadly.