80 lines
2.3 KiB
GDScript
80 lines
2.3 KiB
GDScript
extends RefCounted
|
|
|
|
const DEEP_NAVY := Color("0b1324")
|
|
const ROYAL_BLUE := Color("2563eb")
|
|
const SKY_BLUE := Color("38bdf8")
|
|
const PURPLE := Color("7c3aed")
|
|
const MAGENTA := Color("d946ef")
|
|
const TEAL := Color("14b8a6")
|
|
const SUCCESS := Color("22c55e")
|
|
const AMBER := Color("f59e0b")
|
|
const SLATE := Color("94a3b8")
|
|
const DARK_TEXT := Color("f8fafc")
|
|
const LIGHT_TEXT := Color("0f172a")
|
|
|
|
static var font: Font = preload("res://assets/fonts/Inter-Variable.ttf")
|
|
|
|
|
|
static func text_color(dark: bool) -> Color:
|
|
return DARK_TEXT if dark else LIGHT_TEXT
|
|
|
|
|
|
static func muted_color(dark: bool) -> Color:
|
|
return Color("a9b5ca") if dark else Color("53627a")
|
|
|
|
|
|
static func background_color(dark: bool) -> Color:
|
|
return DEEP_NAVY if dark else Color("f5f8ff")
|
|
|
|
|
|
static func panel_box(dark: bool) -> StyleBoxFlat:
|
|
var box := StyleBoxFlat.new()
|
|
box.bg_color = Color("0b1427cc") if dark else Color("ffffffee")
|
|
box.border_color = Color("33415d") if dark else Color("d4def0")
|
|
box.set_border_width_all(1)
|
|
box.set_corner_radius_all(8)
|
|
box.content_margin_left = 54
|
|
box.content_margin_right = 54
|
|
box.content_margin_top = 48
|
|
box.content_margin_bottom = 42
|
|
return box
|
|
|
|
|
|
static func field_box(dark: bool, focused: bool = false) -> StyleBoxFlat:
|
|
var box := StyleBoxFlat.new()
|
|
box.bg_color = Color("0d172a") if dark else Color("f8faff")
|
|
box.border_color = ROYAL_BLUE if focused else (Color("33415d") if dark else Color("cbd6e8"))
|
|
box.set_border_width_all(1)
|
|
box.set_corner_radius_all(8)
|
|
box.content_margin_left = 18
|
|
box.content_margin_right = 18
|
|
box.content_margin_top = 15
|
|
box.content_margin_bottom = 15
|
|
return box
|
|
|
|
|
|
static func secondary_button_box(dark: bool, hover: bool = false) -> StyleBoxFlat:
|
|
var box := field_box(dark, hover)
|
|
box.bg_color = Color("111b30") if dark else Color("ffffff")
|
|
return box
|
|
|
|
|
|
static func gradient_button_box() -> StyleBoxTexture:
|
|
var gradient := Gradient.new()
|
|
gradient.colors = PackedColorArray([Color("1677ff"), Color("8f3ff4")])
|
|
var texture := GradientTexture2D.new()
|
|
texture.gradient = gradient
|
|
texture.width = 512
|
|
texture.height = 64
|
|
texture.fill_from = Vector2(0, 0.5)
|
|
texture.fill_to = Vector2(1, 0.5)
|
|
var box := StyleBoxTexture.new()
|
|
box.texture = texture
|
|
box.content_margin_top = 14
|
|
box.content_margin_bottom = 14
|
|
return box
|
|
|
|
|
|
static func apply_font(control: Control) -> void:
|
|
control.add_theme_font_override("font", font)
|