Bitbybit Docs
    Preparing search index...

    Class BabylonGuiColorPicker

    Color pickers: a color wheel with a square for lightness and saturation, giving a hex color. Subscribe to the value changed event to react to the user.

    Index

    Constructors

    create

    • Creates a color picker starting at defaultColor; size sets both its width and height, as a pixel string or a fraction, and defaults to 300 pixels.

      Parameters

      • inputs: CreateColorPickerDto

        The name, the starting color, the color, the optional width, height and size

      Returns ColorPicker

      The color picker

      const picker = bitbybit.babylon.gui.colorPicker.createColorPicker({ name: "faceColor", defaultColor: "#f0cebb", color: "#f0cebb", size: "200px" });
      panel.addControl(picker);
      picker.onValueChangedObservable.add((color) => { console.log(color.toHexString()); });

    get

    • Reads the color a color picker currently holds, as a hex string.

      Parameters

      Returns string

      The hex color

    • Reads the size of a color picker, its width and height together.

      Parameters

      Returns string | number

      The size

    set

    • Moves a color picker to a hex color, which fires its value changed event like a user pick would.

      Parameters

      Returns ColorPicker

      The same color picker

    • Sets the width and height of a color picker together, as a pixel string or a fraction of the parent.

      Parameters

      Returns ColorPicker

      The same color picker