Set theme variables from file

merge-requests/30/head
Bob Mottram 2020-11-14 17:34:11 +00:00
parent 933c3d965f
commit 566d9cbab8
13 changed files with 650 additions and 5 deletions

View File

@ -310,6 +310,22 @@ def setCustomFont(baseDir: str):
cssfile.write(css)
def readVariablesFile(baseDir: str, themeName: str,
variablesFile: str) -> None:
"""Reads variables from a file in the theme directory
"""
themeParams = loadJson(variablesFile, 0)
if not themeParams:
return
bgParams = {
"login": "jpg",
"follow": "jpg",
"options": "jpg",
"search": "jpg"
}
setThemeFromDict(baseDir, themeName, themeParams, bgParams)
def setThemeDefault(baseDir: str):
name = 'default'
removeTheme(baseDir)
@ -1404,16 +1420,11 @@ def setTheme(baseDir: str, name: str, domain: str) -> bool:
for themeName in themes:
themeNameLower = themeName.lower()
if name == themeNameLower:
themeFunctionExists = False
try:
globals()['setTheme' + themeName](baseDir)
themeFunctionExists = True
except BaseException:
pass
if not themeFunctionExists:
setThemeDefault(baseDir)
if prevThemeName:
if prevThemeName.lower() != themeNameLower:
# change the banner and profile image
@ -1426,6 +1437,10 @@ def setTheme(baseDir: str, name: str, domain: str) -> bool:
setThemeDefault(baseDir)
result = True
variablesFile = baseDir + '/theme/' + themeName.lower() + '/theme.json'
if os.path.isfile(variablesFile):
readVariablesFile(baseDir, themeName.lower(), variablesFile)
setCustomFont(baseDir)
# set the news avatar

View File

@ -0,0 +1,26 @@
{
"banner-height": "20vh",
"banner-height-mobile": "10vh",
"newswire-date-color": "blue",
"font-size-header": "22px",
"font-size-header-mobile": "32px",
"font-size": "45px",
"font-size2": "45px",
"font-size3": "45px",
"font-size4": "35px",
"font-size5": "29px",
"gallery-font-size": "35px",
"gallery-font-size-mobile": "55px",
"main-bg-color": "#002365",
"column-left-color": "#002365",
"text-entry-background": "#002365",
"link-bg-color": "#002365",
"main-bg-color-reply": "#002365",
"main-bg-color-report": "#002365",
"day-number2": "#002365",
"hashtag-vertical-spacing3": "100px",
"hashtag-vertical-spacing4": "150px",
"time-vertical-align": "-10px",
"*font-family": "'Domestic_Manners'",
"*src": "url('./fonts/Domestic_Manners.woff2') format('woff2')"
}

View File

@ -0,0 +1,5 @@
{
"banner-height": "20vh",
"banner-height-mobile": "10vh",
"search-banner-height-mobile": "15vh"
}

View File

@ -0,0 +1,47 @@
{
"focus-color": "green",
"main-bg-color": "black",
"column-left-color": "black",
"link-bg-color": "black",
"main-bg-color-dm": "#0b0a0a",
"main-bg-color-reply": "#030202",
"main-bg-color-report": "#050202",
"main-header-color-roles": "#1f192d",
"main-fg-color": "#00ff00",
"column-left-fg-color": "#00ff00",
"border-color": "#035103",
"main-link-color": "#2fff2f",
"main-link-color-hover": "#afff2f",
"title-color": "#2fff2f",
"main-visited-color": "#3c8234",
"button-selected": "#063200",
"button-background-hover": "#a62200",
"button-text-hover": "#00ff00",
"publish-button-background": "#062200",
"button-background": "#062200",
"button-small-background": "#062200",
"button-text": "#00ff00",
"button-selected-text": "#00ff00",
"publish-button-text": "#00ff00",
"button-small-text": "#00ff00",
"button-corner-radius": "4px",
"timeline-border-radius": "4px",
"*font-family": "'Bedstead'",
"*src": "url('./fonts/bedstead.otf') format('opentype')",
"color: #FFFFFE;": "color: green;",
"calendar-bg-color": "black",
"lines-color": "green",
"day-number": "green",
"day-number2": "darkgreen",
"today-foreground": "white",
"today-circle": "red",
"event-background": "lightgreen",
"event-foreground": "black",
"title-text": "black",
"title-background": "darkgreen",
"gallery-text-color": "green",
"time-color": "#00ff00",
"place-color": "#00ff00",
"event-color": "#00ff00",
"image-corners": "0%"
}

View File

@ -0,0 +1,50 @@
{
"banner-height": "25vh",
"column-left-image-width-mobile": "40vw",
"column-right-image-width-mobile": "40vw",
"font-size-button-mobile": "26px",
"font-size": "32px",
"font-size2": "26px",
"font-size3": "40px",
"font-size4": "24px",
"font-size5": "22px",
"main-bg-color": "#383335",
"column-left-color": "#383335",
"text-entry-background": "#383335",
"link-bg-color": "#383335",
"main-link-color": "white",
"main-link-color-hover": "#ddd",
"title-color": "white",
"main-visited-color": "#e1c4bc",
"main-fg-color": "white",
"column-left-fg-color": "white",
"main-bg-color-dm": "#343335",
"border-color": "#222",
"border-width": "5px",
"border-width-header": "5px",
"main-bg-color-reply": "#383335",
"main-bg-color-report": "#383335",
"hashtag-vertical-spacing3": "100px",
"hashtag-vertical-spacing4": "150px",
"button-background-hover": "#444",
"button-text-hover": "white",
"publish-button-background": "#222",
"button-background": "#222",
"button-selected": "black",
"dropdown-fg-color": "#dddddd",
"dropdown-bg-color": "#444",
"dropdown-bg-color-hover": "#555",
"dropdown-fg-color-hover": "#dddddd",
"calendar-bg-color": "#383335",
"title-text": "#c5d2b9",
"title-background": "#444",
"lines-color": "#c5d2b9",
"day-number": "#c5d2b9",
"day-number2": "#ccc",
"event-background": "#333",
"timeline-border-radius": "20px",
"image-corners": "8%",
"quote-right-margin": "0.1em",
"*font-family": "'bgrove'",
"*src": "url('fonts/bgrove.woff2') format('woff2')"
}

View File

@ -0,0 +1,68 @@
{
"container-button-padding": "0px",
"hashtag-background-color": "darkred",
"font-size-newswire": "18px",
"font-size-publish-button": "18px",
"font-size-newswire-mobile": "40px",
"line-spacing-newswire": "100%",
"newswire-item-moderated-color": "white",
"newswire-date-moderated-color": "white",
"newswire-date-color": "white",
"newswire-voted-background-color": "black",
"column-left-image-width-mobile": "40vw",
"column-right-fg-color": "#ff9900",
"column-right-fg-color-voted-on": "red",
"button-corner-radius": "5px",
"timeline-border-radius": "5px",
"focus-color": "blue",
"font-size-button-mobile": "26px",
"font-size": "32px",
"font-size2": "26px",
"font-size3": "40px",
"font-size4": "24px",
"font-size5": "22px",
"main-bg-color": "black",
"column-left-header-color": "#fff",
"column-left-header-background": "#555",
"column-left-header-size": "20px",
"column-left-color": "#003366",
"text-entry-background": "#0f0d10",
"link-bg-color": "black",
"main-link-color": "#ff9900",
"main-link-color-hover": "#d09338",
"main-visited-color": "#ffb900",
"main-fg-color": "white",
"column-left-fg-color": "white",
"main-bg-color-dm": "#0b0a0a",
"border-color": "#003366",
"border-width": "0",
"border-width-header": "0",
"main-bg-color-reply": "#0f0d10",
"main-bg-color-report": "#0f0d10",
"hashtag-vertical-spacing3": "100px",
"hashtag-vertical-spacing4": "150px",
"button-background-hover": "darkblue",
"button-text-hover": "white",
"publish-button-background": "#ff9900",
"publish-button-text": "#003366",
"button-background": "#003366",
"button-selected": "blue",
"calendar-bg-color": "#0f0d10",
"event-background": "#555",
"border-color": "#003366",
"lines-color": "#ff9900",
"day-number": "lightblue",
"day-number2": "white",
"time-color": "#003366",
"place-color": "#003366",
"event-color": "#003366",
"title-text": "white",
"title-background": "#003366",
"quote-right-margin": "0.1em",
"column-left-width": "10vw",
"column-center-width": "70vw",
"column-right-width": "20vw",
"column-right-icon-size": "11%",
"login-button-color": "red",
"login-button-fg-color": "white"
}

View File

@ -0,0 +1,112 @@
{
"follow-text-size1": "14px",
"follow-text-size2": "30px",
"hashtag-size1": "20px",
"hashtag-size2": "30px",
"font-size-calendar-header": "2rem",
"font-size-calendar-cell": "2rem",
"calendar-horizontal-padding": "20%",
"time-vertical-align": "10px",
"header-vertical-offset": "-10%",
"publish-button-vertical-offset": "0",
"vertical-between-posts-header": "0 0",
"header-button-padding": "0 0",
"containericons-horizontal-spacing": "0%",
"font-size-header": "14px",
"font-size": "22px",
"font-size2": "16px",
"font-size3": "30px",
"font-size4": "14px",
"font-size5": "12px",
"font-size-likes": "10px",
"font-size-links": "12px",
"font-size-newswire": "12px",
"font-size-newswire-mobile": "30px",
"font-size-dropdown-header": "30px",
"post-separator-margin-top": "1%",
"post-separator-margin-bottom": "1%",
"post-separator-width": "95%",
"post-separator-height": "1px",
"column-left-border-width": "1px",
"column-right-border-width": "0px",
"column-left-border-color": "black",
"column-left-header-color": "black",
"column-left-header-background": "white",
"column-left-header-style": "none",
"search-banner-height": "15vh",
"search-banner-height-mobile": "10vh",
"container-button-padding": "0px",
"container-button-margin": "0px",
"column-left-icon-size": "15%",
"column-right-icon-size": "15%",
"button-height-padding": "5px",
"icon-brightness-change": "70%",
"border-width": "0px",
"border-width-header": "0px",
"tab-border-width": "3px",
"tab-border-color": "grey",
"button-corner-radius": "0px",
"login-button-color": "#25408f",
"login-button-fg-color": "white",
"column-left-width": "10vw",
"column-center-width": "80vw",
"column-right-width": "10vw",
"column-right-fg-color": "#25408f",
"column-right-fg-color-voted-on": "red",
"newswire-item-moderated-color": "red",
"newswire-date-moderated-color": "red",
"newswire-date-color": "grey",
"timeline-border-radius": "0px",
"button-background": "#767674",
"button-background-hover": "#555",
"button-text-hover": "white",
"button-selected": "white",
"button-selected-text": "black",
"button-text": "white",
"hashtag-fg-color": "white",
"publish-button-background": "#25408f",
"publish-button-text": "white",
"hashtag-background-color": "#b2b2b2",
"focus-color": "grey",
"font-size-button-mobile": "26px",
"font-size-publish-button": "14px",
"rgba(0, 0, 0, 0.5)": "rgba(0, 0, 0, 0.0)",
"column-left-color": "white",
"main-bg-color": "white",
"main-bg-color-dm": "white",
"link-bg-color": "white",
"main-bg-color-reply": "white",
"main-bg-color-report": "white",
"main-header-color-roles": "#ebebf0",
"main-fg-color": "black",
"column-left-fg-color": "#25408f",
"border-color": "#c0cdd9",
"main-link-color": "#25408f",
"main-link-color-hover": "#10408f",
"title-color": "#2a2c37",
"main-visited-color": "#25408f",
"text-entry-foreground": "#111",
"text-entry-background": "white",
"font-color-header": "black",
"dropdown-fg-color": "#222",
"dropdown-fg-color-hover": "#222",
"dropdown-bg-color": "#e6ebf0",
"dropdown-bg-color-hover": "lightblue",
"color: #FFFFFE;": "color: black;",
"calendar-bg-color": "#e6ebf0",
"lines-color": "darkblue",
"day-number": "black",
"day-number2": "#282c37",
"place-color": "black",
"event-color": "#282c37",
"today-foreground": "white",
"today-circle": "red",
"event-background": "lightblue",
"event-foreground": "white",
"title-text": "#282c37",
"title-background": "#ccc",
"gallery-text-color": "black",
"*font-family": "'NimbusSanL'",
"*src": "url('./fonts/NimbusSanL.otf') format('opentype')",
"**src": "url('./fonts/NimbusSanL-italic.otf') format('opentype')"
}

View File

@ -0,0 +1,67 @@
{
"newswire-date-color": "#cfb42b",
"column-left-header-background": "#9fb42b",
"column-left-header-color": "#33390d",
"main-bg-color": "#9fb42b",
"column-left-color": "#33390d",
"column-left-fg-color": "#9fb42b",
"link-bg-color": "#33390d",
"text-entry-foreground": "#33390d",
"text-entry-background": "#9fb42b",
"main-bg-color-reply": "#9fb42b",
"main-bg-color-report": "#9fb42b",
"main-bg-color-dm": "#5fb42b",
"main-header-color-roles": "#9fb42b",
"main-fg-color": "#33390d",
"border-color": "#33390d",
"border-width": "5px",
"border-width-header": "5px",
"main-link-color": "#9fb42b",
"main-link-color-hover": "#cfb42b",
"title-color": "#9fb42b",
"main-visited-color": "#9fb42b",
"button-selected": "black",
"button-highlighted": "green",
"button-background-hover": "#a3390d",
"button-text-hover": "#33390d",
"publish-button-background": "#33390d",
"button-background": "#33390d",
"button-small-background": "#33390d",
"button-text": "#9fb42b",
"button-selected-text": "#9fb42b",
"publish-button-text": "#9fb42b",
"button-small-text": "#9fb42b",
"color: #FFFFFE;": "color: #9fb42b;",
"calendar-bg-color": "#eee",
"day-number": "#3f2145",
"day-number2": "#9fb42b",
"today-foreground": "white",
"today-circle": "red",
"event-background": "yellow",
"event-foreground": "white",
"title-text": "white",
"gallery-text-color": "#33390d",
"font-size-header": "22px",
"font-size-header-mobile": "32px",
"font-size": "45px",
"font-size2": "45px",
"font-size3": "45px",
"font-size4": "35px",
"font-size5": "29px",
"gallery-font-size": "35px",
"gallery-font-size-mobile": "55px",
"button-corner-radius": "1px",
"timeline-border-radius": "1px",
"dropdown-bg-color": "#33390d",
"dropdown-bg-color-hover": "#7fb42b",
"dropdown-fg-color-hover": "black",
"dropdown-fg-color": "#9fb42b",
"font-color-header": "#9fb42b",
"lines-color": "#33390d",
"title-background": "#33390d",
"time-color": "#33390d",
"place-color": "#33390d",
"event-color": "#33390d",
"*font-family": "'LcdSolid'",
"*src": "url('./fonts/LcdSolid.woff2') format('woff2')"
}

View File

@ -0,0 +1,55 @@
{
"newswire-item-moderated-color": "grey",
"newswire-date-moderated-color": "grey",
"newswire-date-color": "#0562bd",
"search-banner-height": "25vh",
"search-banner-height-mobile": "15vh",
"banner-height": "20vh",
"banner-height-mobile": "10vh",
"hashtag-background-color": "lightblue",
"focus-color": "grey",
"font-size-button-mobile": "26px",
"font-size": "32px",
"font-size2": "26px",
"font-size3": "40px",
"font-size4": "24px",
"font-size5": "22px",
"rgba(0, 0, 0, 0.5)": "rgba(0, 0, 0, 0.0)",
"column-left-color": "#e6ebf0",
"main-bg-color": "#e6ebf0",
"main-bg-color-dm": "#e3dbf0",
"link-bg-color": "#e6ebf0",
"main-bg-color-reply": "#e0dbf0",
"main-bg-color-report": "#e3dbf0",
"main-header-color-roles": "#ebebf0",
"main-fg-color": "#2d2c37",
"column-left-fg-color": "#2d2c37",
"border-color": "#c0cdd9",
"main-link-color": "#2a2c37",
"main-link-color-hover": "#aa2c37",
"title-color": "#2a2c37",
"main-visited-color": "#232c37",
"text-entry-foreground": "#111",
"text-entry-background": "white",
"font-color-header": "black",
"dropdown-fg-color": "#222",
"dropdown-fg-color-hover": "#222",
"dropdown-bg-color": "white",
"dropdown-bg-color-hover": "lightgrey",
"color: #FFFFFE;": "color: black;",
"calendar-bg-color": "#e6ebf0",
"lines-color": "darkblue",
"day-number": "black",
"day-number2": "#282c37",
"place-color": "black",
"event-color": "#282c37",
"today-foreground": "white",
"today-circle": "red",
"event-background": "lightblue",
"event-foreground": "white",
"title-text": "#282c37",
"title-background": "#ccc",
"gallery-text-color": "black",
"*font-family": "'ElectrumADFExp-Regular'",
"*src": "url('./fonts/ElectrumADFExp-Regular.otf') format('opentype')"
}

View File

@ -0,0 +1,51 @@
{
"main-visited-color": "#0481f5",
"post-separator-margin-top": "9%",
"post-separator-margin-bottom": "9%",
"post-separator-width": "80%",
"post-separator-height": "10%",
"column-left-header-background": "#07447c",
"banner-height": "15vh",
"banner-height-mobile": "10vh",
"focus-color": "blue",
"font-size-button-mobile": "26px",
"font-size": "32px",
"font-size2": "26px",
"font-size3": "40px",
"font-size4": "24px",
"font-size5": "22px",
"main-bg-color": "#0f0d10",
"column-left-color": "#0f0d10",
"text-entry-background": "#0f0d10",
"link-bg-color": "#0f0d10",
"main-link-color": "#6481f5",
"main-link-color-hover": "#d09338",
"main-fg-color": "#0481f5",
"column-left-fg-color": "#0481f5",
"main-bg-color-dm": "#0b0a0a",
"border-color": "#606984",
"main-bg-color-reply": "#0f0d10",
"main-bg-color-report": "#0f0d10",
"hashtag-vertical-spacing3": "100px",
"hashtag-vertical-spacing4": "150px",
"button-background-hover": "#0481f5",
"button-text-hover": "#0f0d10",
"publish-button-background": "#07447c",
"button-background": "#07447c",
"button-selected": "#0481f5",
"calendar-bg-color": "#0f0d10",
"lines-color": "#0481f5",
"day-number": "#0481f5",
"day-number2": "white",
"time-color": "#0481f5",
"time-vertical-align": "-4px",
"time-vertical-align-mobile": "15px",
"place-color": "#0481f5",
"event-color": "#0481f5",
"event-background": "#00014a",
"quote-right-margin": "0",
"line-spacing": "150%",
"*font-family": "'solidaric'",
"*src": "url('./fonts/solidaric.woff2') format('woff2')",
"**src": "url('./fonts/solidaric-italic.woff2') format('woff2')"
}

View File

@ -0,0 +1,66 @@
{
"font-size-pgp-key2": "18px",
"button-corner-radius": "5px",
"column-left-icons-margin": "15px",
"post-separator-width": "96.5%",
"post-separator-height": "40px",
"border-width-header": "0",
"border-width": "0",
"banner-height": "35vh",
"banner-height-mobile": "15vh",
"search-banner-height-mobile": "15vh",
"time-vertical-align": "-4px",
"time-vertical-align-mobile": "15px",
"hashtag-background-color": "lightred",
"button-highlighted": "darkred",
"button-selected-highlighted": "darkred",
"newswire-date-color": "grey",
"focus-color": "grey",
"font-size-button-mobile": "26px",
"font-size": "32px",
"font-size2": "26px",
"font-size3": "40px",
"font-size4": "24px",
"font-size5": "22px",
"rgba(0, 0, 0, 0.5)": "rgba(0, 0, 0, 0.0)",
"main-bg-color": "white",
"column-left-color": "white",
"main-bg-color-dm": "white",
"link-bg-color": "white",
"main-bg-color-reply": "white",
"main-bg-color-report": "white",
"main-header-color-roles": "#ebebf0",
"main-fg-color": "#2d2c37",
"column-left-fg-color": "#2d2c37",
"border-color": "#c0cdd9",
"main-link-color": "#2a2c37",
"main-link-color-hover": "#aa2c37",
"title-color": "#2a2c37",
"main-visited-color": "#232c37",
"text-entry-foreground": "#111",
"text-entry-background": "white",
"font-color-header": "black",
"dropdown-fg-color": "#222",
"dropdown-fg-color-hover": "#222",
"dropdown-bg-color": "white",
"dropdown-bg-color-hover": "lightgrey",
"color: #FFFFFE;": "color: black;",
"calendar-bg-color": "white",
"lines-color": "black",
"day-number": "black",
"day-number2": "#282c37",
"place-color": "black",
"event-color": "#282c37",
"today-foreground": "white",
"today-circle": "red",
"event-background": "lightblue",
"event-foreground": "white",
"title-text": "#282c37",
"title-background": "#ccc",
"gallery-text-color": "black",
"quote-right-margin": "0",
"line-spacing": "150%",
"*font-family": "'solidaric'",
"*src": "url('./fonts/solidaric.woff2') format('woff2')",
"**src": "url('./fonts/solidaric-italic.woff2') format('woff2')"
}

View File

@ -0,0 +1,56 @@
{
"search-banner-height-mobile": "15vh",
"column-left-header-background": "#69282c",
"column-left-image-width-mobile": "40vw",
"line-spacing-newswire": "120%",
"focus-color": "darkred",
"font-size-button-mobile": "26px",
"font-size": "32px",
"font-size2": "26px",
"font-size3": "40px",
"font-size4": "24px",
"font-size5": "22px",
"main-bg-color": "#0f0d10",
"column-left-color": "#0f0d10",
"text-entry-background": "#0f0d10",
"link-bg-color": "#0f0d10",
"main-link-color": "#ffc4bc",
"main-link-color-hover": "white",
"title-color": "#ffc4bc",
"main-visited-color": "#e1c4bc",
"main-fg-color": "#ffc4bc",
"column-left-fg-color": "#ffc4bc",
"main-bg-color-dm": "#0b0a0a",
"border-color": "#69282c",
"border-width": "3px",
"border-width-header": "3px",
"main-bg-color-reply": "#0f0d10",
"main-bg-color-report": "#0f0d10",
"hashtag-vertical-spacing3": "100px",
"hashtag-vertical-spacing4": "150px",
"button-background-hover": "#a9282c",
"button-text-hover": "#ffc4bc",
"publish-button-background": "#69282c",
"button-background": "#69282c",
"button-small-background": "darkblue",
"button-selected": "#a34046",
"button-highlighted": "#12435f",
"button-fg-highlighted": "white",
"button-selected-highlighted": "#12435f",
"button-approve": "#12435f",
"calendar-bg-color": "#0f0d10",
"title-text": "#ffc4bc",
"title-background": "#69282c",
"lines-color": "#ffc4bc",
"day-number": "#ffc4bc",
"day-number2": "#aaa",
"event-background": "#12435f",
"timeline-border-radius": "20px",
"time-color": "#ffc4bc",
"place-color": "#ffc4bc",
"event-color": "#ffc4bc",
"image-corners": "2%",
"quote-right-margin": "0.1em",
"*font-family": "'bgrove'",
"*src": "url('fonts/bgrove.woff2') format('woff2')"
}

View File

@ -0,0 +1,27 @@
{
"banner-height": "25vh",
"banner-height-mobile": "10vh",
"newswire-date-color": "yellow",
"main-bg-color": "#5c4e41",
"column-left-color": "#5c4e41",
"text-entry-background": "#5c4e41",
"link-bg-color": "#5c4e41",
"main-bg-color-reply": "#5c4e41",
"main-bg-color-report": "#5c4e41",
"day-number2": "#5c4e41",
"border-color": "#463b35",
"border-width": "7px",
"border-width-header": "7px",
"main-link-color": "#dddddd",
"main-link-color-hover": "white",
"title-color": "#dddddd",
"main-visited-color": "#dddddd",
"button-background-hover": "#a63b35",
"publish-button-background": "#463b35",
"button-background": "#463b35",
"button-selected": "#26201d",
"main-bg-color-dm": "#5c4a40",
"main-header-color-roles": "#5c4e41",
"dropdown-bg-color": "#504e41",
"dropdown-bg-color-hover": "#444"
}