From d502b3be1e26f7a8ff2aeb5e43f9134b0798c259 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 14 Nov 2020 15:28:29 +0000 Subject: [PATCH] Automatically detect available themes --- theme.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/theme.py b/theme.py index ee0f4ea12..faf8f3fc2 100644 --- a/theme.py +++ b/theme.py @@ -18,16 +18,18 @@ def getThemeFiles() -> []: 'options.css', 'search.css', 'links.css') -def getThemesList() -> []: +def getThemesList(baseDir: str) -> []: """Returns the list of available themes Note that these should be capitalized, since they're also used to create the web interface dropdown list and to lookup function names """ - return ('Default', 'Blue', 'Hacker', 'Henge', 'HighVis', - 'IndymediaClassic', 'IndymediaModern', - 'LCD', 'Light', 'Night', 'Purple', 'Solidaric', - 'Starlight', 'Zen') + themes = [] + for subdir, dirs, files in os.walk(baseDir + '/theme'): + for themeName in dirs: + themes.append(themeName.title()) + print('Themes available: ' + str(themes)) + return themes def setThemeInConfig(baseDir: str, name: str) -> bool: