@zeplin/extension-model
    Preparing search index...

    Class Color

    A class that represents an RGBA color

    Index

    Constructors

    Properties

    a: number = 1

    Alpha component of the color in interval [0, 1]

    b: number = 0

    Blue component of the color in interval [0, 255]

    g: number = 0

    Green component of the color in interval [0, 255]

    isVariable: boolean = false

    Indicator to differentiate color variables from color styles

    linkedVariableSourceId?: string

    Unique identifier of the linked color variable, which is converted from a color variable

    name?: string

    Name of the color

    originalName?: string

    Original name of the color

    r: number = 0

    Red component of the color in interval [0, 255]

    sourceId?: string

    Unique identifier of the color

    Accessors

    • get ALLOWED_FIELDS(): string[]

      Returns string[]

    Methods

    • Checks whether some other color is equal to this one

      Parameters

      Returns boolean

      Whether the colors are equal

    • Gets the formatted name of the color using the specified naming scheme

      Parameters

      • OptionalnamingScheme: NamingScheme

        The naming scheme to use

      Returns undefined | string

      Formatted color name

    • Returns the base hex string without the # prefix

      Returns string

      Hex string without prefix

    • Converts the color to a hexadecimal string

      Returns string

      Hexadecimal color string

    • Return the HSLA representation of the color

      Returns HSLColor

      HSL object

    • Gets the HSLA values as a CSS string

      Returns string

      CSS compatible hsla string

    • Gets the RGBA values as a CSS string

      Returns string

      CSS compatible rgba (or rgb if alpha is below 1.0) string

    • Creates a Color instance from a JSON string

      Parameters

      • json: string

        JSON string representing a color

      Returns Color

      A new Color instance