Penpot plugins API
    Preparing search index...

    Interface TokenColor

    Represents a token of type Color. This interface extends TokenBase and specifies the data type of the value.

    interface TokenColor {
        id: string;
        name: string;
        description: string;
        duplicate(): Token;
        remove(): void;
        resolvedValueString: string | undefined;
        applyToShapes(
            shapes: Shape[],
            properties: TokenProperty[] | undefined,
        ): void;
        applyToSelected(properties: TokenProperty[] | undefined): void;
        type: "color";
        value: string;
        resolvedValue: string | undefined;
    }

    Hierarchy (View Summary)

    Index

    Properties

    id: string

    The unique identifier for this token, used only internally inside Penpot. This one is not exported or synced with external Design Token sources.

    name: string

    The name of the token. It may include a group path separated by ..

    description: string

    An optional description text.

    resolvedValueString: string | undefined

    The value calculated by finding all tokens with the same name in active sets and resolving the references.

    It's converted to string, regardless of the data type of the value depending on the token type. It can be undefined if no value has been found in active sets.

    type: "color"

    The type of the token.

    value: string

    The value as defined in the token itself. It's a rgb color or a reference.

    resolvedValue: string | undefined

    The value as defined in the token itself. It's a rgb color or a reference.

    Methods

    • Removes this token from the catalog.

      It will NOT be unapplied from any shape, since there may be other tokens with the same name.

      Returns void

    • Applies this token to one or more properties of the given shapes.

      Parameters

      • shapes: Shape[]

        is an array of shapes to apply it.

      • properties: TokenProperty[] | undefined

        an optional list of property names. If omitted, the default properties will be applied.

        NOTE that the tokens application is by name and not by id. If there exist several tokens with the same name in different sets, the actual token applied and the value set to the attributes will depend on which sets are active (and will change if different sets or themes are activated later).

      Returns void