EvaluationContext.Colour.Hex.AdjustAlpha
Adjusts the alpha component of a hex color
Syntax
EvaluationContext.Colour.Hex.AdjustAlpha(hexColor, alphaChange)
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
hexColor | STRING | Yes | The hex color to adjust (e.g., “■ #01B8AA”) |
alphaChange | DOUBLE | Yes | The alpha adjustment (-1 to 1) |
Returns
(STRING) Modified hex colour
Example
EvaluationContext.Colour.Hex.AdjustAlpha("#5E81AC", -2.0) // Returns "#5E81AC66"
Definition
EvaluationContext.Colour.Hex.AdjustAlpha =
(
hexColor: STRING,
alphaChange: DOUBLE
) =>
VAR CleanHex = IF( LEFT( hexColor, 1) = "#", MID( hexColor, 2, 6), MID( hexColor, 1, 6 ) )
VAR A = EvaluationContext.Colour.Hex.Alpha( hexColor )
VAR NewA = EvaluationContext.Colour.Int.ToHex( MIN( MAX( A + alphaChange, 0 ), 1 ) * 255, 2 )
VAR result = "#" & CleanHex & NewA
RETURN result