matheus23 / elm-figma-api / Figma.Appearance

Fills and strokes


type StrokeAlign
    = 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 : Basics.Bool
, opacity : Basics.Float
, color : Color
, blendMode : BlendMode 
}

Solid color paint.


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

A image-textured paint.


type ScaleMode
    = FillMode
    | FitMode
    | TileMode
    | StretchMode

Image scaling mode.


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

A color gradient paint. In particular:

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.


type alias ColorStop =
{ position : Basics.Float
, color : Color 
}

A position color pair representing a gradient stop.

Text styling


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

Character formatting.


type alias TextStyleOverride =
{ fontFamily : Maybe String
, fontPostScriptName : Maybe String
, isItalic : Maybe Basics.Bool
, fontWeight : Maybe Basics.Int
, fontSize : Maybe Basics.Float
, horizontalAlign : Maybe TextHorizontalAlign
, verticalAlign : Maybe TextVerticalAlign
, letterSpacing : Maybe Basics.Float
, fills : Maybe (List Paint)
, lineHeightPx : Maybe Basics.Float
, lineHeightPercent : Maybe Basics.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.


type TextHorizontalAlign
    = LeftAlign
    | RightAlign
    | CenterHorizontalAlign
    | JustifiedAlign


type TextVerticalAlign
    = TopAlign
    | CenterVerticalAlign
    | BottomAlign

Blending modes and effetcs


type BlendMode
    = 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 : Basics.Bool
, radius : Basics.Float 
}

Blur visual effect.


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

Shadow visual effect.