99
1010SYSTEM_THEME = "system"
1111DARK_THEME = "dark"
12+ DEFAULT_THEME = DARK_THEME
1213_THEME_PROPERTY = "application_theme"
1314_RECENT_PROJECTS_PATH = Path .home () / ".drunkenbot_ide" / "recent_projects.json"
1415
1516
1617def normalize_theme (theme : object ) -> str :
17- """Return a supported theme name, defaulting to the system theme."""
18- return DARK_THEME if theme == DARK_THEME else SYSTEM_THEME
18+ """Return a supported theme name, defaulting to the application's Dark theme."""
19+ return SYSTEM_THEME if theme == SYSTEM_THEME else DARK_THEME
1920
2021
2122def load_startup_theme () -> str :
2223 """Load the theme selected for the most recently opened project."""
2324 try :
2425 recent_projects = json .loads (_RECENT_PROJECTS_PATH .read_text (encoding = "utf-8" ))
2526 except (OSError , json .JSONDecodeError ):
26- return SYSTEM_THEME
27+ return DEFAULT_THEME
2728 if not isinstance (recent_projects , list ):
28- return SYSTEM_THEME
29+ return DEFAULT_THEME
2930 for entry in recent_projects :
3031 if not isinstance (entry , dict ):
3132 continue
@@ -36,13 +37,13 @@ def load_startup_theme() -> str:
3637 continue
3738 if isinstance (project_state , dict ):
3839 return normalize_theme (project_state .get ("theme" ))
39- return SYSTEM_THEME
40+ return DEFAULT_THEME
4041
4142
4243def current_theme () -> str :
4344 """Return the QApplication theme currently in effect."""
4445 app = QApplication .instance ()
45- return normalize_theme (app .property (_THEME_PROPERTY ) if app is not None else SYSTEM_THEME )
46+ return normalize_theme (app .property (_THEME_PROPERTY ) if app is not None else DEFAULT_THEME )
4647
4748
4849def apply_theme (theme : object ) -> str :
0 commit comments