Up to date

This page is up to date for Godot 4.3. If you still find outdated information, please open an issue.

ColorButton

Inherits: BaseButton < Control < CanvasItem < Node < Object

A Button That displays a color.

Description

A Button That displays a color.

Properties

Color

color

Color(1, 1, 1, 1)

bool

edit_alpha

true

bool

flat

false

Methods

void

set_color(color: Color)

Theme Properties

Texture2D

bg

Texture2D

overbright_indicator

StyleBox

disabled

StyleBox

focus

StyleBox

hover

StyleBox

hover_pressed

StyleBox

normal

StyleBox

pressed


Signals

color_changed(color: Color) 🔗

Emitted when the color is changed.


Property Descriptions

Color color = Color(1, 1, 1, 1) 🔗

  • void set_color_no_signal(value: Color)

  • Color get_color()

The button's display color.


bool edit_alpha = true 🔗

  • void set_edit_alpha(value: bool)

  • bool is_editing_alpha()

If true, shows an alpha channel slider (opacity).


bool flat = false 🔗

  • void set_flat(value: bool)

  • bool is_flat()

Draws the buttons without the styles.


Method Descriptions

void set_color(color: Color) 🔗

Changes the button's color and emits color_changed.


Theme Property Descriptions

Texture2D bg 🔗

The background image displayed behind the color when the color alpha is less than one.


Texture2D overbright_indicator 🔗

The indicator used to signalize that the color value is outside the 0-1 range.


StyleBox disabled 🔗

StyleBox used when the Button is disabled.


StyleBox focus 🔗

StyleBox used when the Button is focused. The focus StyleBox is displayed over the base StyleBox, so a partially transparent StyleBox should be used to ensure the base StyleBox remains visible. A StyleBox that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a StyleBoxEmpty resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.


StyleBox hover 🔗

StyleBox used when the Button is being hovered.


StyleBox hover_pressed 🔗

StyleBox used when the Button is being pressed and hovered at the same time.


StyleBox normal 🔗

Default StyleBox for the Button.


StyleBox pressed 🔗

StyleBox used when the Button is being pressed.