85 lines
3.2 KiB
GDScript
85 lines
3.2 KiB
GDScript
extends RefCounted
|
|
|
|
const BACKGROUND := Color("121827")
|
|
const SURFACE := Color("1d2638")
|
|
const SURFACE_DARK := Color("151c2b")
|
|
const SURFACE_LIGHT := Color("27334a")
|
|
const TEXT := Color("f6f8ff")
|
|
const MUTED := Color("aeb8ca")
|
|
const CYAN := Color("4de1ff")
|
|
const LIME := Color("a6ff5f")
|
|
const MAGENTA := Color("ff4fd8")
|
|
const AMBER := Color("ffc857")
|
|
const RED := Color("ff5f6d")
|
|
|
|
static func apply_app_theme(root: Control) -> void:
|
|
var theme := Theme.new()
|
|
theme.set_color("font_color", "Label", TEXT)
|
|
theme.set_color("font_color", "Button", TEXT)
|
|
theme.set_color("font_color", "RichTextLabel", TEXT)
|
|
theme.set_font_size("font_size", "Label", 17)
|
|
theme.set_font_size("font_size", "Button", 16)
|
|
theme.set_stylebox("normal", "Button", button_box(SURFACE_LIGHT, Color("3b4964")))
|
|
theme.set_stylebox("hover", "Button", button_box(Color("33425d"), CYAN))
|
|
theme.set_stylebox("pressed", "Button", button_box(Color("21344a"), LIME))
|
|
theme.set_stylebox("disabled", "Button", button_box(Color("202637"), Color("2c3445")))
|
|
theme.set_stylebox("focus", "Button", StyleBoxEmpty.new())
|
|
root.theme = theme
|
|
|
|
|
|
static func panel_box(color: Color = SURFACE, border: Color = Color("33415c")) -> StyleBoxFlat:
|
|
var box := StyleBoxFlat.new()
|
|
box.bg_color = color
|
|
box.border_color = border
|
|
box.set_border_width_all(1)
|
|
box.corner_radius_top_left = 8
|
|
box.corner_radius_top_right = 8
|
|
box.corner_radius_bottom_left = 8
|
|
box.corner_radius_bottom_right = 8
|
|
box.content_margin_left = 18
|
|
box.content_margin_right = 18
|
|
box.content_margin_top = 16
|
|
box.content_margin_bottom = 16
|
|
return box
|
|
|
|
|
|
static func button_box(color: Color, border: Color) -> StyleBoxFlat:
|
|
var box := StyleBoxFlat.new()
|
|
box.bg_color = color
|
|
box.border_color = border
|
|
box.set_border_width_all(1)
|
|
box.corner_radius_top_left = 6
|
|
box.corner_radius_top_right = 6
|
|
box.corner_radius_bottom_left = 6
|
|
box.corner_radius_bottom_right = 6
|
|
box.content_margin_left = 14
|
|
box.content_margin_right = 14
|
|
box.content_margin_top = 10
|
|
box.content_margin_bottom = 10
|
|
return box
|
|
|
|
|
|
static func set_label(label: Label, font_size: int, color: Color = TEXT) -> void:
|
|
label.add_theme_font_size_override("font_size", font_size)
|
|
label.add_theme_color_override("font_color", color)
|
|
|
|
|
|
static func style_primary_button(button: Button) -> void:
|
|
button.add_theme_stylebox_override("normal", button_box(Color("18465a"), CYAN))
|
|
button.add_theme_stylebox_override("hover", button_box(Color("20647e"), Color("8df1ff")))
|
|
button.add_theme_stylebox_override("pressed", button_box(Color("153b4d"), LIME))
|
|
button.add_theme_color_override("font_color", TEXT)
|
|
|
|
|
|
static func style_answer_button(button: Button) -> void:
|
|
button.add_theme_stylebox_override("normal", button_box(SURFACE_DARK, Color("303c55")))
|
|
button.add_theme_stylebox_override("hover", button_box(Color("26354f"), CYAN))
|
|
button.add_theme_stylebox_override("pressed", button_box(Color("20384d"), CYAN))
|
|
button.add_theme_color_override("font_color", TEXT)
|
|
|
|
|
|
static func style_chip(button: Button, color: Color) -> void:
|
|
button.add_theme_stylebox_override("normal", button_box(Color(color, 0.22), color))
|
|
button.add_theme_stylebox_override("hover", button_box(Color(color, 0.34), color))
|
|
button.add_theme_color_override("font_color", TEXT)
|