matheus23/elm-figma-api/1.0.0

Figma.Appearance

Fills and strokes

= InsideStroke
| OutsideStroke
| CenterStroke

Where stroke is drawn relative to the vector outline.

type Paint
= ColorPaint SolidColor
| ImagePaint Image
| LinearGradientPaint Gradient
| RadialGradientPaint Gradient
| AngularGradientPaint Gradient
| EmojiPaint
| DiamondGradientPaint Gradient

A solid color, gradient, or image texture that can be applied as fills or strokes.

type alias SolidColor =
{ isVisible : Bool
, opacity : Float
, color : Color
, blendMode : BlendMode
}

Solid color paint.

type alias Image =
{ isVisible : Bool
, opacity : Float
, scaleMode : ScaleMode
, blendMode : BlendMode
}

A image-textured paint.

= FillMode
| FitMode
| TileMode
| StretchMode

Image scaling mode.

type alias Gradient =
{ isVisible : Bool
, opacity : Float
, start : Vec2
, stop : Vec2
, width : Vec2
, colorStops : List ColorStop
, blendMode : BlendMode
}

A color gradient paint. In particular:

  • start: position of the start handle for the gradient (value 0, for the purposes of calculating gradient stops)
  • stop: position of the end handle for the gradient (value 1),
  • width: width of the gradient (only relevant for non-linear gradients)

These three values are stored in normalized object space. Normalized object space is if the top left corner of the bounding box of the object is 0, 0 and the bottom right is 1,1.

  • colorStops: positions of key points along the gradient axis with the colors anchored there. Colors along the gradient are interpolated smoothly between neighboring gradient stops.
type alias ColorStop =
{ position : Float
, color : Color
}

A position color pair representing a gradient stop.

Text styling

type alias TextStyle =
{ fontFamily : String
, fontPostScriptName : String
, isItalic : Bool
, fontWeight : Int
, fontSize : Float
, horizontalAlign : TextHorizontalAlign
, verticalAlign : TextVerticalAlign
, letterSpacing : Float
, fills : List Paint
, lineHeightPx : Float
, lineHeightPercent : Float
}

Character formatting.

type alias TextStyleOverride =
{ fontFamily : Maybe String
, fontPostScriptName : Maybe String
, isItalic : Maybe Bool
, fontWeight : Maybe Int
, fontSize : Maybe Float
, horizontalAlign : Maybe TextHorizontalAlign
, verticalAlign : Maybe TextVerticalAlign
, letterSpacing : Maybe Float
, fills : Maybe (List Paint)
, lineHeightPx : Maybe Float
, lineHeightPercent : Maybe Float
}

Character formatting overrides.

Only relevant fields are set while specifying an override. All other fields are supposed to be found in the master TextStyle record.

= LeftAlign
| RightAlign
| CenterHorizontalAlign
| JustifiedAlign
= TopAlign
| CenterVerticalAlign
| BottomAlign

Blending modes and effetcs

= NormalMode
| PassThroughMode
| DarkenMode
| MultiplyMode
| LinearBurnMode
| ColorBurnMode
| LightenMode
| ScreenMode
| LinearDodgeMode
| ColorDodgeMode
| OverlayMode
| SoftLightMode
| HardLightMode
| DifferenceMode
| ExclusionMode
| HueMode
| SaturationMode
| ColorMode
| LuminosityMode

How a layer blends with layers below.

type Effect
= InnerShadowEffect Shadow
| DropShadowEffect Shadow
| LayerBlurEffect Blur
| BackgroundBlurEffect Blur

A visual effect such as a shadow or blur.

type alias Blur =
{ isVisible : Bool
, radius : Float
}

Blur visual effect.

type alias Shadow =
{ isVisible : Bool
, radius : Float
, color : Color
, blendMode : BlendMode
, offset : Vec2
}

Shadow visual effect.