Canvas Toolkit
← Class index

CColorDialog

Dialogs · extends CDialog

Dialog for interactively selecting an RGB color.

import { CColorDialog } from "canvas-toolkit-lib";

Declared members

static readonly DefaultWidth = 300;
static readonly DefaultHeight = 360;
static readonly Margin = 12;
static readonly Spacing = 6;
readonly currentColorChanged: CSignal<[CColor]>;

Emitted whenever the current color changes.

readonly colorSelected: CSignal<[CColor]>;

Emitted when the current color is accepted.

constructor(color?: CColor, parent?: CWidget | null);

Creates a color selection dialog. @param color Initial color. @param parent Optional parent widget.

currentColor(): CColor;

Returns a copy of the currently selected color. @returns Current color.

setCurrentColor(color: CColor): void;

Sets the current color. @param color Color to select.

static getColor(initial: CColor, parent?: CWidget | null): Promise<CColor | null>;

Shows a modal color dialog. @param initial Initial color. @param parent Optional parent widget. @returns A promise resolving to the selected color, or `null` if rejected.