From e008c1f742694c9796c94a9428365bd6f06f707a Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 29 Jan 2023 14:52:22 +0100 Subject: [PATCH] Update templates --- resources/views/layout/default.twig | 4 ++-- resources/views/layout/empty.twig | 15 ++++++++++++++- resources/views/layout/guest.twig | 15 ++++++++++++++- resources/views/layout/install.twig | 1 + 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/resources/views/layout/default.twig b/resources/views/layout/default.twig index d12cbc040b..3db76f138b 100644 --- a/resources/views/layout/default.twig +++ b/resources/views/layout/default.twig @@ -7,6 +7,7 @@ + {% if subTitle %} @@ -21,11 +22,10 @@ {# CSS things #} - {# libraries #} - + {# the theme #} diff --git a/resources/views/layout/empty.twig b/resources/views/layout/empty.twig index 516e82c9f7..64c420276a 100644 --- a/resources/views/layout/empty.twig +++ b/resources/views/layout/empty.twig @@ -9,6 +9,7 @@ + {# CSS things #} @@ -19,7 +20,19 @@ {# the theme #} - + + + {# Firefly III customisations #} diff --git a/resources/views/layout/guest.twig b/resources/views/layout/guest.twig index f96592aad6..47d43be007 100644 --- a/resources/views/layout/guest.twig +++ b/resources/views/layout/guest.twig @@ -5,6 +5,7 @@ + Firefly III @@ -29,7 +30,19 @@ {# the theme #} <link href="v1/lib/adminlte/css/AdminLTE.min.css?v={{ FF_VERSION }}" rel="stylesheet" type="text/css" nonce="{{ JS_NONCE }}"> - <link href="v1/lib/adminlte/css/skins/skin-blue-light.min.css?v={{ FF_VERSION }}" rel="stylesheet" type="text/css" nonce="{{ JS_NONCE }}"> + <script nonce="{{ JS_NONCE }}"> + // If `prefers-color-scheme` is not supported, fall back to light mode. + // In this case, light.css will be downloaded with `highest` priority. + if (window.matchMedia('(prefers-color-scheme: dark)').media === 'not all') { + document.documentElement.style.display = 'none'; + document.head.insertAdjacentHTML( + 'beforeend', + '<link rel="stylesheet" href="v1/lib/adminlte/css/skins/skin-light.css?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}" onload="document.documentElement.style.display = \'\'">', + ); + } + </script> + <link href="v1/lib/adminlte/css/skins/skin-light.css?v={{ FF_VERSION }}" rel="stylesheet" type="text/css" nonce="{{ JS_NONCE }}" media="(prefers-color-scheme: light)"> + <link href="v1/lib/adminlte/css/skins/skin-dark.css?v={{ FF_VERSION }}" rel="stylesheet" type="text/css" nonce="{{ JS_NONCE }}" media="(prefers-color-scheme: dark)"> {# Firefly III customisations #} <link href="v1/css/firefly.css?v={{ FF_VERSION }}" rel="stylesheet" type="text/css" nonce="{{ JS_NONCE }}"> diff --git a/resources/views/layout/install.twig b/resources/views/layout/install.twig index a4cc4e9c81..5dcb483edd 100644 --- a/resources/views/layout/install.twig +++ b/resources/views/layout/install.twig @@ -9,6 +9,7 @@ <meta name="csrf-token" content="{{ csrf_token() }}"> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <meta name="apple-mobile-web-app-capable" content="yes"> + <meta name="color-scheme" content="light dark"> {# libraries #} <link href="v1/lib/bs/css/bootstrap.min.css?v={{ FF_VERSION }}" rel="stylesheet" type="text/css" nonce="{{ JS_NONCE }}">