Skip to content

ColorPalette

Extends: HBoxContainer

Description

Dungeondraft unique UI Control that allows the user to set a color for the tool and create a color palette.

Properties

ColorRect colorRect
TextureRect iconRect
Button paletteButton
Button instantButton
Popup popup
ItemList colorList
Popup colorPickerPopup
ColorPicker colorPicker
PopupMenu menu
Color color

Methods

String[] Save ( )
void Load ( String[] data )
void SetColor ( Color color, bool emitSignal = true )
void AddPresets ( String[] hexcodes )
void ShowPalette ( )
void ShowPicker ( )

Signals

  • color_changed ( ):
    Signal emitted when the color is changed. Returns a Color. Not used but is emitted.

Property Descriptions

  • ColorRect colorRect:
    The box that shows the selected color to the user.

  • TextureRect iconRect:
    The dropdown arrow icon. Does not affect use.

  • Button paletteButton:
    The button the user presses to show the palette.

  • Button instantButton:
    The button the user presses to open the color picker.

  • Popup popup:
    The popup where the presets are displayed.

  • ItemList colorList:
    The ItemList that holds the individual preset colors.

  • Popup colorPickerPopup:
    The color picker popup.

  • ColorPicker colorPicker:
    Godot ColorPicker used by this Control to add new colors.

  • PopupMenu menu:
    The right-click context menu where the user can remove a color preset.

  • Color color:
    Color currently selected. Use SetColor() to change color. ONLY SAFE TO READ.

Method Descriptions

  • String[] Save ( ):
    Saves and returns the presets as an Array of hexcodes.

  • void Load ( String[] data ):
    Loads the presets from an Array of hexcodes. Calls AddPresets() internally.

  • void SetColor ( Color color, bool emitSignal = true ):
    Force the ColorPalette to set a specific color. If emitSignal is set, it emits the color_changed signal.

  • void AddPresets ( String[] hexcodes ):
    Takes an Array of hexcodes and adds them as colors to the color palette.

  • void ShowPalette ( ):
    Show the color palette selector