Set background format

main
Bob Mottram 2020-07-25 17:25:04 +01:00
parent 2dca999231
commit 107d7be5ea
1 changed files with 18 additions and 0 deletions

View File

@ -109,6 +109,23 @@ def setThemeFromDict(baseDir: str, name: str, themeParams: {}) -> None:
cssfile.write(css)
def setBackgroundFormat(baseDir: str, name: str, extension: str) -> None:
"""Sets the background file extension
"""
if extension == 'png':
return
themeFiles = getThemeFiles()
for filename in themeFiles:
cssFilename = baseDir + '/' + filename
if not os.path.isfile(cssFilename):
continue
with open(cssFilename, 'r') as cssfile:
css = cssfile.read()
css.replace('-background.png', '-background.' + extension)
with open(cssfilename, 'w+') as cssfile:
cssfile.write(css)
def enableGrayscale(baseDir: str) -> None:
"""Enables grayscale for the current theme
"""
@ -311,6 +328,7 @@ def setThemeStarlight(baseDir: str):
"*src": "url('fonts/bgrove.woff2') format('woff2')"
}
setThemeFromDict(baseDir, 'starlight', themeParams)
setBackgroundFormat(baseDir, 'starlight', 'jpg')
def setThemeHenge(baseDir: str):