Skip to main content

ColorPlugin

A plugin for handling color metadata.

Hierarchy

  • MetadataPlugin
    • ColorPlugin

Index

Constructors

constructor

  • Returns ColorPlugin

Properties

readonlyname

name: color = "color"

The name of the plugin.

Methods

fromJSON

  • fromJSON(value: string | object): number
  • Parses the color value from a JSON string or object.


    Parameters

    • value: string | object

      The JSON value.

    Returns number

    The numeric representation of the color.

getColor

  • getColor(value: string | number): number
  • Converts a color name or value into its numeric representation.


    Parameters

    • value: string | number

      The color value (name, string, or number).

    Returns number

    The numeric representation of the color.

getTrait

  • getTrait(params: { key: string; type: string; value: string | number }): { canonicalRepresentation: number; key: Field; value: MetadataValue }
  • Retrieves the trait representation of the color value.


    Parameters

    • params: { key: string; type: string; value: string | number }

      The parameters including key, type, and value.

      • key: string
      • type: string
      • value: string | number

    Returns { canonicalRepresentation: number; key: Field; value: MetadataValue }

    An object containing the key, value, and canonical representation.

toJSON

  • toJSON(value: string | number): string
  • Converts the color value to a JSON string.


    Parameters

    • value: string | number

      The color value.

    Returns string

    The JSON string representation.