Studio
  • Why Studio?
  • Getting Started
  • Setting up Studio
    • Import from Tokens Studio for Figma
    • Import from Figma variables
  • Connect Studio to Figma
    • Using Tokens Studio for Figma
    • Using Companion by Tokens Studio
  • Connect Studio to Code
  • Platform
    • Features
      • Tokens
        • Token Sets
        • Token flow
      • Themes
        • Theme Groups and Theme Options
      • Configuration
      • Releases
    • Platform
      • Accounts
      • Organisation
      • Project
      • API keys
      • Inviting members
  • GRAPH ENGINE
    • Introduction
    • Editor
    • Creating a Graph Based Set
    • Nodes
    • Types
    • Editing
    • Available Nodes
      • Accessibility
        • Color Blindness
      • Array
        • Array Filter
        • Array Find
        • Arrify
        • Concat
        • Flatten
        • Index Array
        • Inject Item
        • Array Length
        • Array Push
        • Remove Item
        • Replace Item
        • Reverse Array
        • Slice Array
        • Sort Array
        • Array Map
      • Color
        • Color To String
        • Color Wheel
        • Contrast
        • Contrasting Alpha
        • Contrasting Color
        • Contrasting from Array
        • Convert Color
        • Create Color
        • Darken Color
        • Deconstruct Color
        • Delta E
        • Distance
        • Flatten Alpha
        • Lighten Color
        • Match Alpha
        • Mix Colors
        • Name Color
        • Poline
        • Range
        • Scale Colors
        • Sort Colors By Distance
        • String To Color
      • CSS
        • CSS Accessible Clamp
        • CSS Box
        • CSS Function
        • CSS Map
      • Curves
        • Bezier Curve
        • Construct Float Curve
        • Deconstruct Float Curve
        • Flip Float Curve
        • Preset Bezier Curves
        • Sample Array from Float Curve
        • Sample Curve
        • Sample Float Curve
      • Design Tokens
        • Array To Set
        • Create Border
        • Create Border Design Token
        • Create Box Shadow
        • Create Box Shadow Design Token
        • Create Design Token
        • Create Reference
        • Create Typography
        • Create Typography Design Token
        • Destruct Token
        • External Token Set
        • Extract Token
        • Flatten Token Sets
        • Group Tokens
        • Inline Tokens
        • Invert Token Set
        • Leonardo Color
        • Leonardo Theme
        • Name Tokens
        • Preview Typography
        • Resolve Tokens
        • Set To Array
        • Ungroup Tokens
        • Group Token Array
        • Ungroup Token Array
      • Figma
        • Code Syntax
        • Publish Varibales
        • Scope All
        • Scope by Type
        • Scope Color
        • Scope Number
        • Scope String
      • Generic
        • Constant
        • Delay
        • Input
        • Object Merge
        • Note
        • Object Path
        • Objectify
        • Output
        • Panic
        • Passthrough
        • Subgraph
        • Time
      • Gradient
        • Gradient Stop
      • Logic
        • And
        • Compare
        • If
        • Not
        • Or
        • Switch
      • Math
        • Absolute
        • Add
        • Add Variadic
        • Ceiling
        • Clamp
        • Closest Number
        • Cosine
        • Count
        • Difference
        • Divide
        • Divide Variadic
        • Evaluate Math
        • Exponentiation
        • Floor
        • Fluid
        • Lerp
        • Modulo
        • Multiply
        • Multiply Variadic
        • Power
        • Random
        • Range Mapping
        • Round
        • Sine
        • Snap
        • Square Root
        • Subtract
        • Subtract Variadic
        • Tangent
      • Preview
        • Color Compare
        • Color Scale
        • Color Swatch
        • Math Expression
        • Number
        • Preview Curve
      • Search
        • Find First Match
        • Linear Search
      • Series
        • Alternating Series
        • Arithmetic Series
        • Exponential Decay
        • Fibonacci Series
        • Geometric Series
        • Harmonic Series
        • Inverse Linear Mapping
        • Linear Space
        • Power Series
      • String
        • Case Convert
        • Interpolation
        • Join Array
        • Lowercase
        • Normalize
        • Pad
        • Regex
        • Replace
        • Split String
        • Stringify
        • Uppercase
      • Typography
        • Base Font Size
      • Typing
        • Assert Defined
        • Has Value
        • Parse Number
        • Parse Unit
        • Pass Unit
      • Vector2
        • Create
        • Destructure
      • Naming
        • Alphabetic Scale
        • Alphanumeric Scale
        • Greek Letter
        • Hierarchy Level
        • Numeric Scale
        • T-Shirt Size
  • PLUGINS
    • Tokens Studio for Figma Plugin
    • Companion by Tokens Studio
    • Tokens Studio for Framer Plugin
Powered by GitBook
On this page
  • Why Strong Typing Matters
  • What Are Types?
  • Supported Types
  • Type Conversion
Edit on GitHub
  1. GRAPH ENGINE

Types

Why Strong Typing Matters

Every port in the Graph Engine is strongly typed, meaning it only accepts specific data types (e.g., a "number" port won’t take a "color"). This keeps your graphs reliable by:

  • Catching mistakes early (e.g., no connecting a string to a math node).

  • Ensuring predictable outputs for design tokens or code.

  • Making complex systems easier to debug and scale.

What Are Types?

Types define what kind of data a port handles—like "number" for 42, "color" for #FF5733, or "array" for a list. They’re the rules that keep your graph running smoothly.

How to Identify the Type of an Input or Output

Ports use visual cues:

  • Colors: Show the type (see legend from the Top Action Bar > Layout > Legend ):

    • Red: Color

    • Magenta: Curve

    • Green: String

    • Gold: Boolean

    • Blue: Number

    • Teal: Object

    • Purple: Any

  • Shapes:

    • Dot: Single value (e.g., one color).

    • Square: Array (e.g., list of colors). Hovering over a port shows its type label (e.g., "color") if "Port Types" is enabled in settings.

  • Type Labels:

    • Enable the labels for Port to easily identify the type. This can be done from Top Action Bar > Graph Setting > Show Inline Types.

Supported Types

Here’s what you’ll work with:

  • Number: Integers or decimals (e.g., 5, 3.14).

  • String: Text (e.g., "bold", "#FF5733").

  • Color: Color objects (e.g., RGB, HSL formats).

  • Array: Lists (e.g., [10, 20, 30], ["#FF5733", "#33FF57"]).

  • Object: Key-value pairs (e.g., { "primary": "#FF5733" }).

  • Boolean: True/false.

  • Token Set: A special type for design token collections (e.g., a JSON-like structure).

Type Conversion

Mismatched types block connections, but conversion nodes fix this:

  • Why It’s Needed:

    • Example: A "Color Generator" outputs a color object, but a "Create Design Token" needs a hex string. They won’t connect directly.

  • How to Convert:

    • Scenario: Convert a color to a hex string.

      1. Connect the "Create Color" output (color) to a "Color to String" node’s input.

      2. The node outputs a hex string (e.g., "#FF5733").

      3. Plug this into the "Create Design Token" input, which now works.

    • Other Conversions: "Stringify" (e.g., 10 → "10").

PreviousNodesNextEditing

Last updated 2 months ago