Globally define theme colours

This commit is contained in:
2021-10-12 21:25:43 +02:00
parent b4c278b970
commit 58e3984ffc
4 changed files with 26 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ function drawGraph(element, label, dataType) {
datasets: [ datasets: [
{ {
label: label, label: label,
backgroundColor: highlightColor, backgroundColor: "#" + window.style.highlightColor,
borderWidth: 0, borderWidth: 0,
lineTension: 0, lineTension: 0,
fill: true, fill: true,

View File

@@ -19,9 +19,16 @@ Skyscraper.prototype.open = function () {
} }
if (skyscraperType === "a-ads") { if (skyscraperType === "a-ads") {
let adsColours = "&background_color=" + window.style.layer2Color +
"&text_color=" + window.style.textColor +
"&title_color=" + window.style.highlightColor +
"&title_hover_color=" + window.style.highlightColor +
"&link_color=" + window.style.highlightColor +
"&link_hover_color=" + window.style.highlightColor
this.divAdSpace.innerHTML = `<iframe this.divAdSpace.innerHTML = `<iframe
data-aa="1811738" data-aa="1811738"
src="//ad.a-ads.com/1811738?size=160x600" src="//ad.a-ads.com/1811738?size=160x600${adsColours}"
style="width:160px; height:600px; border:0px; padding:0; overflow:hidden; background-color: transparent;" > style="width:160px; height:600px; border:0px; padding:0; overflow:hidden; background-color: transparent;" >
</iframe>` </iframe>`
} else { } else {

View File

@@ -8,6 +8,7 @@
{{ template "opengraph" .OGData }} {{ template "opengraph" .OGData }}
{{ template "user_style" . }} {{ template "user_style" . }}
{{ template "user_style_js" . }}
<link rel="icon" sizes="32x32" href="/res/img/pixeldrain_32.png" /> <link rel="icon" sizes="32x32" href="/res/img/pixeldrain_32.png" />
<link rel="icon" sizes="128x128" href="/res/img/pixeldrain_128.png" /> <link rel="icon" sizes="128x128" href="/res/img/pixeldrain_128.png" />
@@ -324,7 +325,6 @@
let captchaKey = '{{.Other.CaptchaKey}}'; let captchaKey = '{{.Other.CaptchaKey}}';
let embeddedViewer = {{.Other.Embedded}}; let embeddedViewer = {{.Other.Embedded}};
let userAuthenticated = {{.Authenticated}}; let userAuthenticated = {{.Authenticated}};
let highlightColor = '#{{.Style.HighlightColor.RGB}}';
let skyscraperType = "{{.Other.AdSkyscraperType}}" let skyscraperType = "{{.Other.AdSkyscraperType}}"
{{template `util.js`}} {{template `util.js`}}

View File

@@ -4,3 +4,19 @@
{{template "layout.css" .}} {{template "layout.css" .}}
</style> </style>
{{end}} {{end}}
{{ define "user_style_js" }}
<script>
window.style = {
textColor: "{{.Style.TextColor.RGB}}",
inputColor: "{{.Style.InputColor.RGB}}",
inputTextColor: "{{.Style.InputTextColor.RGB}}",
highlightColor: "{{.Style.HighlightColor.RGB}}",
dangerColor: "{{.Style.DangerColor.RGB}}",
layer1Color: "{{.Style.Layer1Color.RGB}}",
layer2Color: "{{.Style.Layer2Color.RGB}}",
layer3Color: "{{.Style.Layer3Color.RGB}}",
layer4Color: "{{.Style.Layer4Color.RGB}}",
}
</script>
{{ end }}