Commit 8cd8a7b2 authored by jan.koester's avatar jan.koester
Browse files

test

parent a14be7ce
Loading
Loading
Loading
Loading
+51 −44
Original line number Diff line number Diff line
@@ -12,11 +12,19 @@ Item {
    property bool engineReady: false

    onMobileModeChanged: reload()
    onDarkPreviewChanged: reload()
    onDarkPreviewChanged: {
        if (engineReady) {
            var theme = darkPreview ? "dark" : "light"
            webView.runJavaScript(
                "document.documentElement.setAttribute('data-theme', '" + theme + "');"
                + "document.body.style.background = getComputedStyle(document.documentElement).getPropertyValue('--blogi-bg');"
                + "document.body.style.color = getComputedStyle(document.documentElement).getPropertyValue('--blogi-text');"
            )
        }
    }

    function themeCss() {
        if (darkPreview) {
            return ":root {"
        var dark = ":root {"
            + "  --blogi-bg: #232627;"
            + "  --blogi-surface: #31363b;"
            + "  --blogi-surface-a: rgba(49,54,59,0.7);"
@@ -36,8 +44,7 @@ Item {
            + "  --blogi-nav-border: #222529;"
            + "  color-scheme: dark;"
            + "}"
        } else {
            return ":root {"
        var light = ":root[data-theme='light'] {"
            + "  --blogi-bg: rgba(235,237,240,1);"
            + "  --blogi-surface: rgba(245,246,248,1);"
            + "  --blogi-surface-a: rgba(245,246,248,0.88);"
@@ -57,7 +64,7 @@ Item {
            + "  --blogi-nav-border: rgba(189,195,199,1);"
            + "  color-scheme: light;"
            + "}"
        }
        return dark + light
    }

    function reload() {