Add Steam and Google brand icons to login OAuth buttons
Steam uses a theme-aware monochrome glyph (light/dark variants) since the button background flips between navy and white; Google keeps its official 4-color mark, which reads fine on either background.
This commit is contained in:
@@ -4,6 +4,9 @@ const Brand := preload("res://scripts/ui/medmind_style.gd")
|
||||
const EndpointConfig := preload("res://scripts/autoload/api_endpoint_config.gd")
|
||||
const AUTH_BASE := "https://us3q.ranaze.com/api/Auth"
|
||||
const EXTERNAL_AUTH_STORAGE_PREFIX := "ranaze_external_auth_url_"
|
||||
const STEAM_DARK_ICON := preload("res://assets/icons/brands/steam-dark.svg")
|
||||
const STEAM_LIGHT_ICON := preload("res://assets/icons/brands/steam-light.svg")
|
||||
const GOOGLE_ICON := preload("res://assets/icons/brands/google.svg")
|
||||
|
||||
var main: Control
|
||||
var auth_base_url := AUTH_BASE
|
||||
@@ -258,6 +261,8 @@ func _build_login_view() -> VBoxContainer:
|
||||
for provider in [["steam", "Steam"], ["google", "Google"]]:
|
||||
var external := Button.new()
|
||||
external.text = "Sign in with %s" % provider[1]
|
||||
external.icon = GOOGLE_ICON if provider[0] == "google" else STEAM_LIGHT_ICON
|
||||
external.add_theme_constant_override("icon_max_width", 20)
|
||||
external.custom_minimum_size = Vector2(0, 68)
|
||||
external.visible = false
|
||||
external.pressed.connect(_start_external.bind(str(provider[0]), str(provider[1])))
|
||||
@@ -550,6 +555,8 @@ func _apply_theme() -> void:
|
||||
if not button.text.begins_with("Sign in with "):
|
||||
button.add_theme_stylebox_override("normal", Brand.gradient_button_box())
|
||||
button.add_theme_color_override("font_color", Color.WHITE)
|
||||
if external_buttons.has("steam"):
|
||||
(external_buttons["steam"] as Button).icon = STEAM_DARK_ICON if dark else STEAM_LIGHT_ICON
|
||||
var theme_normal := StyleBoxFlat.new()
|
||||
theme_normal.bg_color = Color("111b30") if dark else Brand.LIGHT_SURFACE
|
||||
theme_normal.border_color = Color("33415d") if dark else Brand.LIGHT_BORDER
|
||||
|
||||
Reference in New Issue
Block a user