diff --git a/config.inc.php b/config.inc.php index b4b42f8..860e44e 100755 --- a/config.inc.php +++ b/config.inc.php @@ -11,7 +11,7 @@ $timeBeforeDeletion = 60 * 60 * 24 * 7; // EN: Theme's name (must be in the themes directory) // FR : Nom du thème (doit être dans le dossier themes) -$theme = "dark"; +$theme = "libreqr"; // EN: Language used if those requested by the user are not available // FR : Langue utilisée si celles demandées par l'utilisateurice ne sont pas disponibles diff --git a/index.php b/index.php index a20df53..547854c 100755 --- a/index.php +++ b/index.php @@ -89,7 +89,6 @@ if (badQuery()) { LibreQR · <?= $loc['subtitle'] ?> - @@ -101,13 +100,20 @@ if (badQuery()) { // Then delete it unlink("temp/style.min.css"); - require "less.php/lessc.inc.php"; - $less = new lessc; - $less->setVariables($variablesTheme); // Make these colors available in style.less - $less->setFormatter("compressed"); - $less->checkedCompile("style.less", "temp/style.min.css"); // Compile, minimise and cache style.less into style.min.css + require_once "less.php/lib/Less/Autoloader.php"; + Less_Autoloader::register(); + + $options = array('cache_dir' => '/srv/http/libreqr/temp/', 'compress' => true); + $cssFileName = Less_Cache::Get(array("/srv/http/libreqr/style.less" => ""), $options, $colorScheme); + + //require "less.php/lessc.inc.php"; + //$less = new lessc; + //$less->setVariables($lightTheme); // Make these colors available in style.less + //$less->setVariables($darkTheme); + //$less->setFormatter("compressed"); + //$less->checkedCompile("style.less", "temp/style.min.css"); // Compile, minimise and cache style.less into style.min.css ?> - + ", "scope": "", "display": "standalone", - "theme_color": "", - "background_color": "", "orientation": "portrait", "icons": [ diff --git a/style.less b/style.less index 9e2be91..1e3b80e 100755 --- a/style.less +++ b/style.less @@ -10,17 +10,34 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ +@light: ~"(prefers-color-scheme: light)"; +@dark: ~"(prefers-color-scheme: dark)"; * { font-family: system-ui, sans-serif; - scrollbar-color: @text @bg; + scrollbar-width: auto; + + @media @light { + scrollbar-color: @text-light @bg-light; + } + + @media @dark { + scrollbar-color: @text-dark @bg-dark; + } } a { - color: @text; text-decoration: underline; + @media @light { + color: @text-light; + } + + @media @dark { + color: @text-dark; + } + &:hover { text-decoration: none; } @@ -31,10 +48,17 @@ p { } details .helpText { - background-color: @bgHelp; padding: 5px; border-radius: 10px; text-align: left; + + @media @light { + background-color: @bgHelp-light; + } + + @media @dark { + background-color: @bgHelp-dark; + } } #menusDeroulants summary { @@ -76,11 +100,19 @@ main { body { margin: 18px; - background-color: @bg; - color: @text; font-weight: normal; font-size: 20px; height: 99%; + + @media @light { + color: @text-light; + background-color: @bg-light; + } + + @media @dark { + color: @text-dark; + background-color: @bg-dark; + } } html { @@ -143,8 +175,16 @@ h2 { } ::selection { - color: @bg; - background-color: @text; + + @media @light { + color: @bg-light; + background-color: @text-light; + } + + @media @dark { + color: @bg-dark; + background-color: @text-dark; + } } label[for=txt] { @@ -167,13 +207,26 @@ label[for=txt] { } .metaText { - color: @text; padding: 6px; + @media @light { + color: @text-light; + } + + @media @dark { + color: @text-dark; + } & a, a:visited { - color: @text; text-decoration: underline; + @media @light { + color: @text-light; + } + + @media @dark { + color: @text-dark; + } } + } footer { @@ -202,40 +255,83 @@ header, footer { /* Inputs */ #redondancy, #margin, #txt, #size, input[type=color], input[type=submit], .button { - border: 2px @border solid; + border-width: 2px; + border-style: solid; border-radius: 10px; font-size: 20px; padding-left: 10px; font-weight: normal; - color: @text; transition: border 0.1s linear; - background-color: @bgField; margin-top: 8px; + @media @light { + color: @text-light; + background-color: @bgField-light; + border-color: @border-light; + } + + @media @dark { + color: @text-dark; + background-color: @bgField-dark; + border-color: @border-dark; + } + &:hover { - border: 2px @borderHover solid; + border-width: 2px; + border-style: solid; + @media @light { + color: @text-light; + } + + @media @dark { + color: @text-dark; + } } &:focus { - border: 2px @borderFocus solid; + border-width: 2px; + border-style: solid; outline: none; + + @media @light { + border-color: @borderHover-light; + } + + @media @dark { + border-color: @borderHover-dark; + } } } #redondancy, #size, #margin { - background-color: @bgField; width: 250px; height: 40px; + @media @light { + background-color: @bgField-light; + } + + @media @dark { + background-color: @bgField-dark; + } } #txt { - background-color: @bgTextField; - color: @text; padding: 10px; margin: 10px; width: 500px; - scrollbar-color: @text @bgTextField; scrollbar-width: auto; + + @media @light { + background-color: @bgTextField-light; + color: @text-light; + scrollbar-color: @text-light @bgTextField-light; + } + + @media @dark { + background-color: @bgTextField-dark; + color: @text-dark; + scrollbar-color: @text-dark @bgTextField-dark; + } } input[type=submit] { @@ -246,18 +342,33 @@ input[type=submit] { } #txt::placeholder { - color: @secondaryText; opacity: 1; font-family: system-ui, sans-serif; font-weight: normal; font-size: 1em; + @media @light { + color: @secondaryText-light; + } + + @media @dark { + color: @secondaryText-dark; + } } input[type=color] { height: 60px; width: 84px; padding: 5px; - border: 2px @border solid; + border-width: 2px; + border-style: solid; + + @media @light { + border-color: @border-light; + } + + @media @dark { + border-color: @border-dark; + } } /* Media queries */ diff --git a/themes/dark/theme.php b/themes/dark/theme.php deleted file mode 100755 index a10332f..0000000 --- a/themes/dark/theme.php +++ /dev/null @@ -1,15 +0,0 @@ - "#2a2a2a", - "bgField" => "#31363B", - "bgTextField" => "#232629", - "bgHelp" => "#151616", - "border" => "#5f5f5f", - "borderHover" => "#808080", - "borderFocus" => "white", - "text" => "white", - "secondaryText" => "#bababa" -); // Définit les couleurs du thème diff --git a/themes/dark/icons/128.png b/themes/libreqr/icons/128.png similarity index 100% rename from themes/dark/icons/128.png rename to themes/libreqr/icons/128.png diff --git a/themes/dark/icons/16.png b/themes/libreqr/icons/16.png similarity index 100% rename from themes/dark/icons/16.png rename to themes/libreqr/icons/16.png diff --git a/themes/dark/icons/192.png b/themes/libreqr/icons/192.png similarity index 100% rename from themes/dark/icons/192.png rename to themes/libreqr/icons/192.png diff --git a/themes/dark/icons/256.png b/themes/libreqr/icons/256.png similarity index 100% rename from themes/dark/icons/256.png rename to themes/libreqr/icons/256.png diff --git a/themes/dark/icons/32.png b/themes/libreqr/icons/32.png similarity index 100% rename from themes/dark/icons/32.png rename to themes/libreqr/icons/32.png diff --git a/themes/dark/icons/384.png b/themes/libreqr/icons/384.png similarity index 100% rename from themes/dark/icons/384.png rename to themes/libreqr/icons/384.png diff --git a/themes/dark/icons/48.png b/themes/libreqr/icons/48.png similarity index 100% rename from themes/dark/icons/48.png rename to themes/libreqr/icons/48.png diff --git a/themes/dark/icons/512.png b/themes/libreqr/icons/512.png similarity index 100% rename from themes/dark/icons/512.png rename to themes/libreqr/icons/512.png diff --git a/themes/dark/icons/64.png b/themes/libreqr/icons/64.png similarity index 100% rename from themes/dark/icons/64.png rename to themes/libreqr/icons/64.png diff --git a/themes/dark/icons/96.png b/themes/libreqr/icons/96.png similarity index 100% rename from themes/dark/icons/96.png rename to themes/libreqr/icons/96.png diff --git a/themes/dark/icons/source.png b/themes/libreqr/icons/source.png similarity index 100% rename from themes/dark/icons/source.png rename to themes/libreqr/icons/source.png diff --git a/themes/libreqr/theme.php b/themes/libreqr/theme.php new file mode 100755 index 0000000..47f015f --- /dev/null +++ b/themes/libreqr/theme.php @@ -0,0 +1,27 @@ + "white", + "bgField-light" => "#eeeeee", + "bgTextField-light" => "#e5e5e5", + "bgHelp-light" => "#ececec", + "border-light" => "#65666b", + "borderHover-light" => "#46484e", + "borderFocus-light" => "#2a2a2a", + "text-light" => "#2a2a2a", + "secondaryText-light" => "#868686", + // Dark theme + "bg-dark" => "#2a2a2a", + "bgField-dark" => "#31363B", + "bgTextField-dark" => "#232629", + "bgHelp-dark" => "#151616", + "border-dark" => "#5f5f5f", + "borderHover-dark" => "#808080", + "borderFocus-dark" => "white", + "text-dark" => "white", + "secondaryText-dark" => "#bababa" +); diff --git a/themes/light/icons/128.png b/themes/light/icons/128.png deleted file mode 100755 index fa27539..0000000 Binary files a/themes/light/icons/128.png and /dev/null differ diff --git a/themes/light/icons/16.png b/themes/light/icons/16.png deleted file mode 100755 index 25d6f37..0000000 Binary files a/themes/light/icons/16.png and /dev/null differ diff --git a/themes/light/icons/192.png b/themes/light/icons/192.png deleted file mode 100755 index 1663f3d..0000000 Binary files a/themes/light/icons/192.png and /dev/null differ diff --git a/themes/light/icons/256.png b/themes/light/icons/256.png deleted file mode 100755 index a2a3166..0000000 Binary files a/themes/light/icons/256.png and /dev/null differ diff --git a/themes/light/icons/32.png b/themes/light/icons/32.png deleted file mode 100755 index f30300f..0000000 Binary files a/themes/light/icons/32.png and /dev/null differ diff --git a/themes/light/icons/384.png b/themes/light/icons/384.png deleted file mode 100755 index 1771a36..0000000 Binary files a/themes/light/icons/384.png and /dev/null differ diff --git a/themes/light/icons/48.png b/themes/light/icons/48.png deleted file mode 100755 index 66c39e6..0000000 Binary files a/themes/light/icons/48.png and /dev/null differ diff --git a/themes/light/icons/512.png b/themes/light/icons/512.png deleted file mode 100755 index 7379b01..0000000 Binary files a/themes/light/icons/512.png and /dev/null differ diff --git a/themes/light/icons/64.png b/themes/light/icons/64.png deleted file mode 100755 index e9f77bc..0000000 Binary files a/themes/light/icons/64.png and /dev/null differ diff --git a/themes/light/icons/96.png b/themes/light/icons/96.png deleted file mode 100755 index 4c03902..0000000 Binary files a/themes/light/icons/96.png and /dev/null differ diff --git a/themes/light/icons/source.png b/themes/light/icons/source.png deleted file mode 100755 index 41c0467..0000000 Binary files a/themes/light/icons/source.png and /dev/null differ diff --git a/themes/light/theme.php b/themes/light/theme.php deleted file mode 100755 index 41b1adb..0000000 --- a/themes/light/theme.php +++ /dev/null @@ -1,15 +0,0 @@ - "white", - "bgField" => "#eeeeee", - "bgTextField" => "#e5e5e5", - "bgHelp" => "#ececec", - "border" => "#65666b", - "borderHover" => "#46484e", - "borderFocus" => "#2a2a2a", - "text" => "#2a2a2a", - "secondaryText" => "#868686" -); // Définit les couleurs du thème diff --git a/themes/parinux/theme.php b/themes/parinux/theme.php index a7c97a5..49c9af9 100755 --- a/themes/parinux/theme.php +++ b/themes/parinux/theme.php @@ -1,15 +1,27 @@ "#14678b", - "bgField" => "#2186b1", - "bgTextField" => "#2186b1", - "bgHelp" => "#118abe", - "border" => "#42a0c8", - "borderHover" => "#87d1f1", - "borderFocus" => "#e2f6ff", - "text" => "#ffffff", - "secondaryText" => "#bbe1f1" -); // Définit les couleurs du thème +$colorScheme = array( + // Light theme + "bg-light" => "#14678b", + "bgField-light" => "#2186b1", + "bgTextField-light" => "#2186b1", + "bgHelp-light" => "#118abe", + "border-light" => "#42a0c8", + "borderHover-light" => "#87d1f1", + "borderFocus-light" => "#e2f6ff", + "text-light" => "#ffffff", + "secondaryText-light" => "#bbe1f1", + // Dark theme + "bg-dark" => "#14678b", + "bgField-dark" => "#2186b1", + "bgTextField-dark" => "#2186b1", + "bgHelp-dark" => "#118abe", + "border-dark" => "#42a0c8", + "borderHover-dark" => "#87d1f1", + "borderFocus-dark" => "#e2f6ff", + "text-dark" => "#ffffff", + "secondaryText-dark" => "#bbe1f1" +); diff --git a/themes/resize.php b/themes/resize.php index c93ade1..67fbd98 100755 --- a/themes/resize.php +++ b/themes/resize.php @@ -1,4 +1,9 @@