From c227c20ee267b9cd834af34b507f9240b5d15053 Mon Sep 17 00:00:00 2001 From: Romain Vigier Date: Fri, 27 Aug 2021 11:19:33 +0200 Subject: [PATCH] Add Zorin themes support --- README.md | 14 ++++++++++---- src/modules/GtkVariants.js | 3 +++ src/modules/ShellVariants.js | 3 +++ tests/gtk_themes/Zorin.js | 20 ++++++++++++++++++++ tests/shell_themes/Zorin.js | 20 ++++++++++++++++++++ 5 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 tests/gtk_themes/Zorin.js create mode 100644 tests/shell_themes/Zorin.js diff --git a/README.md b/README.md index 782dcd2..d74db89 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ Supports Night Light, Location Services, manual schedule and on-demand switch. ## Table of contents - [Theme compatibility](#theme-compatibility) - - [GTK themes](#gtk-themes) - - [Shell themes](#shell-themes) - [Graphical installation](#graphical-installation) - [Command line installation](#command-line-installation) - [Contributing](#contributing) @@ -28,7 +26,8 @@ Supports Night Light, Location Services, manual schedule and on-demand switch. These themes have been tested and work out of the box without any configuration. Other themes might work as well, let me know if there is a specific theme you'd like supported! And you can also manually set your day and night variants. -### GTK themes +
+GTK themes - Adapta - Adwaita (GNOME & Fedora default) @@ -58,8 +57,12 @@ These themes have been tested and work out of the box without any configuration. - WhiteSur - Yaru (Ubuntu default) - Yaru Colors +- Zorin -### Shell themes +
+ +
+Shell themes - Adapta - Adwaita Colors @@ -83,6 +86,9 @@ These themes have been tested and work out of the box without any configuration. - Vimix - WhiteSur - Yaru Colors +- Zorin + +
## Graphical installation diff --git a/src/modules/GtkVariants.js b/src/modules/GtkVariants.js index 125cabf..b187b3f 100644 --- a/src/modules/GtkVariants.js +++ b/src/modules/GtkVariants.js @@ -83,6 +83,9 @@ var GtkVariants = class { } else if (name.includes('vimix')) { variants.set(Time.DAY, name.replace('-dark', '')); variants.set(Time.NIGHT, variants.get(Time.DAY).replace(/vimix(-light)?/, 'vimix-dark')); + } else if (name.includes('Zorin')) { + variants.set(Time.DAY, name.replace('-Dark', '-Light')); + variants.set(Time.NIGHT, variants.get(Time.DAY).replace('-Light', '-Dark')); } else { variants.set(Time.DAY, name.replace(/-dark(?!er)(est)?/, '')); variants.set(Time.NIGHT, variants.get(Time.DAY).replace(/(-light|-darker)/, '') + (name.includes('-darkest') ? '-darkest' : '-dark')); diff --git a/src/modules/ShellVariants.js b/src/modules/ShellVariants.js index 2d6b95b..aea46d8 100644 --- a/src/modules/ShellVariants.js +++ b/src/modules/ShellVariants.js @@ -80,6 +80,9 @@ var ShellVariants = class { } else if (name.includes('vimix')) { variants.set(Time.DAY, name.replace('-dark', '')); variants.set(Time.NIGHT, variants.get(Time.DAY).replace(/vimix(-light)?/, 'vimix-dark')); + } else if (name.includes('Zorin')) { + variants.set(Time.DAY, name.replace('-Dark', '-Light')); + variants.set(Time.NIGHT, variants.get(Time.DAY).replace('-Light', '-Dark')); } else { variants.set(Time.DAY, name.replace(/-dark(?!er)(est)?/, '')); variants.set(Time.NIGHT, variants.get(Time.DAY).replace(/(-light|-darker)/, '') + (name.includes('-darkest') ? '-darkest' : '-dark')); diff --git a/tests/gtk_themes/Zorin.js b/tests/gtk_themes/Zorin.js new file mode 100644 index 0000000..6cf6dad --- /dev/null +++ b/tests/gtk_themes/Zorin.js @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2021 Romain Vigier +// SPDX-License-Identifier: GPL-3.0-or-later + +const test = require('ava'); +const { Variants } = require('./_variants'); + + +['Blue', 'Green', 'Grey', 'Orange', 'Purple', 'Red'].forEach(color => { + test(`Zorin${color}-Light`, t => { + const variants = Variants.guessFrom(`Zorin${color}-Light`); + t.is(variants.get('day'), `Zorin${color}-Light`); + t.is(variants.get('night'), `Zorin${color}-Dark`); + }); + + test(`Zorin${color}-Dark`, t => { + const variants = Variants.guessFrom(`Zorin${color}-Dark`); + t.is(variants.get('day'), `Zorin${color}-Light`); + t.is(variants.get('night'), `Zorin${color}-Dark`); + }); +}); diff --git a/tests/shell_themes/Zorin.js b/tests/shell_themes/Zorin.js new file mode 100644 index 0000000..6cf6dad --- /dev/null +++ b/tests/shell_themes/Zorin.js @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2021 Romain Vigier +// SPDX-License-Identifier: GPL-3.0-or-later + +const test = require('ava'); +const { Variants } = require('./_variants'); + + +['Blue', 'Green', 'Grey', 'Orange', 'Purple', 'Red'].forEach(color => { + test(`Zorin${color}-Light`, t => { + const variants = Variants.guessFrom(`Zorin${color}-Light`); + t.is(variants.get('day'), `Zorin${color}-Light`); + t.is(variants.get('night'), `Zorin${color}-Dark`); + }); + + test(`Zorin${color}-Dark`, t => { + const variants = Variants.guessFrom(`Zorin${color}-Dark`); + t.is(variants.get('day'), `Zorin${color}-Light`); + t.is(variants.get('night'), `Zorin${color}-Dark`); + }); +});