@samatawy/diagrams
    Preparing search index...

    Class ColorPalette

    A class that manages colors frequently used in a diagram. It can be used to support building adaptive editor UIs.

    Index

    Constructors

    Methods

    • List colors in descending order of their frequency.

      Returns string[]

      An array of color strings sorted by their usage frequency.

    • Refreshes the color palette by scanning the diagram for all colors currently in use. This method should be called whenever there are changes to the diagram that may affect color usage. It updates the internal count of colors used in the diagram, which can then be retrieved using frequentColors().

      Returns void

    • Manually adds a color to the palette's tracking. This can be used to populate the palette with known colors.

      Parameters

      • style: string

        The color string to add to the palette.

      Returns void