From 43865c44049627316eea03bc438824e2b70b2912 Mon Sep 17 00:00:00 2001 From: Romain Date: Wed, 15 Apr 2020 21:17:06 +0000 Subject: [PATCH] Add Orchis theme support --- README.md | 1 + ego_description.txt | 1 + src/modules/Variants.js | 2 +- tests/Orchis.js | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 tests/Orchis.js diff --git a/README.md b/README.md index ccd98cb..0e94d58 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ These themes have been tested and work: - Matcha (Manjaro default) - Materia - Mojave +- Orchis - Plata (Solus default) - Pop (Pop!_OS default) - Prof-Gnome-3 diff --git a/ego_description.txt b/ego_description.txt index 9bdf1e9..e7fc9a1 100644 --- a/ego_description.txt +++ b/ego_description.txt @@ -13,6 +13,7 @@ These themes have been tested and work: - Matcha (Manjaro default) - Materia - Mojave +- Orchis - Plata (Solus default) - Pop (Pop!_OS default) - Prof-Gnome-3 diff --git a/src/modules/Variants.js b/src/modules/Variants.js index 7259396..665af5b 100644 --- a/src/modules/Variants.js +++ b/src/modules/Variants.js @@ -56,7 +56,7 @@ var Variants = class { variants.set('day', name.replace(/-Dark(?!er)/, '')); variants.set('night', variants.get('day').replace(/Arc(-Darker)?/, 'Arc-Dark')); } - else if ( name.match(/^(Canta|ChromeOS|Materia).*-compact/) ) { + else if ( name.match(/^(Canta|ChromeOS|Materia|Orchis).*-compact/) ) { variants.set('day', name.replace('-dark', '')); variants.set('night', variants.get('day').replace(/(-light)?-compact/, '-dark-compact')); } diff --git a/tests/Orchis.js b/tests/Orchis.js new file mode 100644 index 0000000..4796296 --- /dev/null +++ b/tests/Orchis.js @@ -0,0 +1,35 @@ +/* +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'); + + +['', '-compact'].forEach(size => { + test(`Orchis${size}`, t => { + const variants = Variants.guess_from(`Orchis${size}`); + t.is(variants.get('day'), `Orchis${size}`); + t.is(variants.get('night'), `Orchis-dark${size}`); + }); + + test(`Orchis-dark${size}`, t => { + const variants = Variants.guess_from(`Orchis-dark${size}`); + t.is(variants.get('day'), `Orchis${size}`); + t.is(variants.get('night'), `Orchis-dark${size}`); + }); +})