43 lines
1.3 KiB
GDScript
43 lines
1.3 KiB
GDScript
class_name ABGUI_Tokens
|
|
extends RefCounted
|
|
|
|
## Shared visual/layout vocabulary. These tokens are deliberately not a page
|
|
## layout: a page may choose its own composition while retaining the same
|
|
## semantic controls, readable type and focus language.
|
|
|
|
const DESIGN_ASPECT := 16.0 / 9.0
|
|
const MIN_TOUCH_TARGET := Vector2(48.0, 48.0)
|
|
const MIN_FOCUS_GAP := 4.0
|
|
const COLOR_INK := Color("#111921")
|
|
const COLOR_NAVY := Color("#182838")
|
|
const COLOR_NAVY_LIFT := Color("#263e53")
|
|
const COLOR_NAVY_DISABLED := Color("#323b43")
|
|
const COLOR_GOLD := Color("#b99a5d")
|
|
const COLOR_GOLD_LIGHT := Color("#ead49b")
|
|
const COLOR_IVORY := Color("#f5ead0")
|
|
const COLOR_SKY := Color("#73b9e7")
|
|
const COLOR_DANGER := Color("#a94b53")
|
|
const COLOR_MUTED := Color("#73808a")
|
|
|
|
const FONT_SIZES := {
|
|
"micro": 11,
|
|
"label": 14,
|
|
"body": 16,
|
|
"heading": 22,
|
|
"title": 30,
|
|
}
|
|
|
|
|
|
static func font_size(role: String, text_scale := 1.0) -> int:
|
|
var base: int = int(FONT_SIZES.get(role, FONT_SIZES.body))
|
|
return maxi(11, int(round(float(base) * maxf(0.8, text_scale))))
|
|
|
|
|
|
static func touch_size(size: Vector2 = Vector2.ZERO) -> Vector2:
|
|
return Vector2(maxf(MIN_TOUCH_TARGET.x, size.x), maxf(MIN_TOUCH_TARGET.y, size.y))
|
|
|
|
|
|
static func is_supported_variant(variant: String) -> bool:
|
|
return variant in ["primary", "secondary", "utility", "danger", "icon"]
|
|
|