Hi everyone,
I’m developing a custom app and I want to use a custom Desk Theme called Modern_ui_theme.
By default, Frappe only allows the following desk themes:
- Light
- Dark
- Automatic
What I’ve done so far
- Overrode
switch_thememethod so users can selectModern_ui_theme:
# hooks.py
override_whitelisted_methods = {
"frappe.core.doctype.user.user.switch_theme": "novasource.override.theme_override.switch_theme"
}
# theme_override.py
import frappe
@frappe.whitelist()
def switch_theme(theme):
if theme in ["Dark", "Light", "Automatic", "Modern_ui_theme"]:
frappe.db.set_value("User", frappe.session.user, "desk_theme", theme)
This works fine when switching themes interactively.
- User creation and System Settings update also work fine — no validation issues there.
The problem
I only face the following error when saving Email Account setup:
Desk Theme cannot be "Modern_ui_theme". It should be one of "Light", "Dark", "Automatic".
It seems like the Email Account process indirectly validates the desk_theme of the current user.
My Question
Is there a more elegant way to allow "Modern_ui_theme" globally, so that it doesn’t break when saving Email Account?
- I don’t want to modify Frappe/ERPNext core.
- I want to keep all other validations intact.
- Ideally, I’d like to extend the allowed desk themes list in one central place, instead of patching multiple doctypes.