Fixed an issue where light theme briefly appears when pgAdmin loads or tools open, even when a dark or system UI theme is preferred. #8711

This commit is contained in:
Anil Sahoo
2025-05-20 10:36:29 +05:30
committed by GitHub
parent 126e1fb53d
commit 4e8f29f328
3 changed files with 52 additions and 27 deletions
+11 -6
View File
@@ -400,12 +400,6 @@ def index():
'pass_enc_key' in session:
session['allow_save_password'] = False
response = Response(render_template(
MODULE_NAME + "/index.html",
username=current_user.username,
_=gettext
))
# Set the language cookie after login, so next time the user will have that
# same option at the login time.
misc_preference = Preferences.module('misc')
@@ -416,11 +410,22 @@ def index():
if user_languages:
language = user_languages.get() or 'en'
# Get the theme preference
user_theme = misc_preference.preference('theme')
theme = user_theme.get() or 'light' if user_theme else 'light'
domain = dict()
if config.COOKIE_DEFAULT_DOMAIN and\
config.COOKIE_DEFAULT_DOMAIN != 'localhost':
domain['domain'] = config.COOKIE_DEFAULT_DOMAIN
response = Response(render_template(
MODULE_NAME + "/index.html",
username=current_user.username,
theme=theme,
_=gettext
))
response.set_cookie("PGADMIN_LANGUAGE", value=language,
path=config.SESSION_COOKIE_PATH,
secure=config.SESSION_COOKIE_SECURE,
@@ -3,6 +3,9 @@
{% block title %}{{ config.APP_NAME }}{% endblock %}
{% block init_script %}
// Set theme on the global window object
window.theme = "{{ theme }}";
function parseConsoleArgs(args) {
const retData = Array.from(args).map(arg => {
try {