From 774b994de32c719a8e92c99b2e244ea4e9e90cb9 Mon Sep 17 00:00:00 2001 From: Romain Vigier Date: Mon, 10 Aug 2020 11:43:08 +0200 Subject: [PATCH] Add support for WhiteSur theme --- README.md | 2 ++ src/modules/GtkVariants.js | 2 +- src/modules/ShellVariants.js | 2 +- tests/gtk_themes/WhiteSur.js | 37 ++++++++++++++++++++++++++++++++++ tests/shell_themes/WhiteSur.js | 37 ++++++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 tests/gtk_themes/WhiteSur.js create mode 100644 tests/shell_themes/WhiteSur.js diff --git a/README.md b/README.md index 57cded3..0b46e91 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ These themes have been tested and work out of the box without any configuration. - Simply Circles - Teja - Vimix +- WhiteSur - Yaru (Ubuntu default) - Yaru Colors @@ -61,6 +62,7 @@ These themes have been tested and work out of the box without any configuration. - Simply Circles - Teja - Vimix +- WhiteSur - Yaru Colors ## Graphical installation diff --git a/src/modules/GtkVariants.js b/src/modules/GtkVariants.js index bae7095..9fa4a38 100644 --- a/src/modules/GtkVariants.js +++ b/src/modules/GtkVariants.js @@ -75,7 +75,7 @@ var GtkVariants = class { const version = name.split('-').pop(); variants.set('day', `McOS-CTLina-Gnome-${version}`); variants.set('night', `Mc-OS-CTLina-Gnome-Dark-${version}`); - } else if (name.includes('Mojave')) { + } else if (name.match(/^(Mojave|WhiteSur)/)) { variants.set('day', name.replace('-dark', '-light')); variants.set('night', variants.get('day').replace('-light', '-dark')); } else if (name.includes('Plata')) { diff --git a/src/modules/ShellVariants.js b/src/modules/ShellVariants.js index 7b21215..0d9f58e 100644 --- a/src/modules/ShellVariants.js +++ b/src/modules/ShellVariants.js @@ -75,7 +75,7 @@ var ShellVariants = class { const version = name.split('-').pop(); variants.set('day', `McOS-CTLina-Gnome-${version}`); variants.set('night', `Mc-OS-CTLina-Gnome-Dark-${version}`); - } else if (name.includes('Mojave')) { + } else if (name.match(/^(Mojave|WhiteSur)/)) { variants.set('day', name.replace('-dark', '-light')); variants.set('night', variants.get('day').replace('-light', '-dark')); } else if (name.includes('Plata')) { diff --git a/tests/gtk_themes/WhiteSur.js b/tests/gtk_themes/WhiteSur.js new file mode 100644 index 0000000..f22d033 --- /dev/null +++ b/tests/gtk_themes/WhiteSur.js @@ -0,0 +1,37 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const test = require('ava'); +const { Variants } = require('./_variants'); + + +['', '-solid'].forEach(transparency => { + ['', '-alt'].forEach(alt => { + test(`WhiteSur-light${transparency}${alt}`, t => { + const variants = Variants.guessFrom(`WhiteSur-light${transparency}${alt}`); + t.is(variants.get('day'), `WhiteSur-light${transparency}${alt}`); + t.is(variants.get('night'), `WhiteSur-dark${transparency}${alt}`); + }); + + test(`WhiteSur-dark${transparency}${alt}`, t => { + const variants = Variants.guessFrom(`WhiteSur-dark${transparency}${alt}`); + t.is(variants.get('day'), `WhiteSur-light${transparency}${alt}`); + t.is(variants.get('night'), `WhiteSur-dark${transparency}${alt}`); + }); + }); +}); diff --git a/tests/shell_themes/WhiteSur.js b/tests/shell_themes/WhiteSur.js new file mode 100644 index 0000000..f22d033 --- /dev/null +++ b/tests/shell_themes/WhiteSur.js @@ -0,0 +1,37 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const test = require('ava'); +const { Variants } = require('./_variants'); + + +['', '-solid'].forEach(transparency => { + ['', '-alt'].forEach(alt => { + test(`WhiteSur-light${transparency}${alt}`, t => { + const variants = Variants.guessFrom(`WhiteSur-light${transparency}${alt}`); + t.is(variants.get('day'), `WhiteSur-light${transparency}${alt}`); + t.is(variants.get('night'), `WhiteSur-dark${transparency}${alt}`); + }); + + test(`WhiteSur-dark${transparency}${alt}`, t => { + const variants = Variants.guessFrom(`WhiteSur-dark${transparency}${alt}`); + t.is(variants.get('day'), `WhiteSur-light${transparency}${alt}`); + t.is(variants.get('night'), `WhiteSur-dark${transparency}${alt}`); + }); + }); +});