ComPDFKit Web SDK
    Preparing search index...

    Function setColorPalette

    • Sets the preset colors of the text / stroke / fill sections of the style panel.

      • An array: global, used by all tools; each item is #rrggbb or 'transparency'. If any item is invalid, warns and changes nothing.
      • { toolNames, colors }: only for these tools (and the annotations they create); warns when toolNames or colors is missing. Writes viewer.customElementOverrides.colorPalette (read by the style panel; 'transparency' draws no swatch, the fill section always has a no-color swatch) and the three color sets (setColors, text / stroke / fill, transparency removed from fill). Tool names are matched exactly; in the object form colors must be an array of valid colors; arguments that are neither an array nor an object are ignored with a warning.

      Parameters

      • palette: string[] | PaletteOption

        An array of colors, or { toolNames, colors }.

      Returns void

      instance.UI.setColorPalette(['#E44234', '#FF8D00', '#1460F3', 'transparency']);