Material Box

Material Box

WEBデザイン & フリー素材

Godot - Buttonのフォーカス、押された時の文字色を変更する

Godot

GDScriptからButtonノードでのフォーカス、押された時の文字色を変更する方法とコード例です。


Buttonノードの背景色を透明にするにはadd_theme_color_override()にて各プロパティに色を指定する事で実装できます。
「font_hover_color」でボタンがフォーカスされた時の文字色、「font_pressed_color」でボタンが押された時の文字色を指定します。

# Buttonノードを作成する
var button = Button.new()
add_child(button)
button.text = "Button"

# フォーカス時の文字色
button.add_theme_color_override("font_hover_color", Color("#F00", 1))
# 押された時の文字色
button.add_theme_color_override("font_pressed_color", Color("#000", 1))

Godot

TitleGodot - Buttonのフォーカス、押された時の文字色を変更する

CategoryGodot

Created

Update

AuthorYousuke.U