From f86d612251534845ddc3420271fddeff6aca28df Mon Sep 17 00:00:00 2001 From: Romain Date: Mon, 20 Apr 2020 17:46:32 +0000 Subject: [PATCH] Add Macwaita theme support --- README.md | 1 + ego_description.txt | 1 + src/modules/Variants.js | 2 +- tests/Macwaita.js | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/Macwaita.js diff --git a/README.md b/README.md index 6aeeca9..82ea905 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ These themes have been tested and work: - HighContrast - Kimi - Layan +- Macwaita - Matcha (Manjaro default) - Materia - Mojave diff --git a/ego_description.txt b/ego_description.txt index 55066db..587a7ee 100644 --- a/ego_description.txt +++ b/ego_description.txt @@ -11,6 +11,7 @@ These themes have been tested and work: - HighContrast - Kimi - Layan +- Macwaita - Matcha (Manjaro default) - Materia - Mojave diff --git a/src/modules/Variants.js b/src/modules/Variants.js index 7c49ae5..b233a79 100644 --- a/src/modules/Variants.js +++ b/src/modules/Variants.js @@ -76,7 +76,7 @@ var Variants = class { variants.set('day', 'HighContrast'); variants.set('night', 'HighContrastInverse'); } - else if ( name.match(/^(Layan|Matcha|Nextwaita)/) ) { + else if ( name.match(/^(Layan|Macwaita|Matcha|Nextwaita)/) ) { const basename = name.split('-')[0]; variants.set('day', name.replace('-dark', '')); variants.set('night', variants.get('day').replace(new RegExp(`${basename}(-light)?`), `${basename}-dark`)); diff --git a/tests/Macwaita.js b/tests/Macwaita.js new file mode 100644 index 0000000..d57c7b6 --- /dev/null +++ b/tests/Macwaita.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'); + + +['', '-Slim'].forEach(size => { + ['-blue', '-green', '-orange', '-purple', '-red', '-yellow'].forEach(color => { + test(`Macwaita${color}${size}`, t => { + const variants = Variants.guess_from(`Macwaita${color}${size}`); + t.is(variants.get('day'), `Macwaita${color}${size}`); + t.is(variants.get('night'), `Macwaita-dark${color}${size}`); + }); + + test(`Macwaita-dark${color}${size}`, t => { + const variants = Variants.guess_from(`Macwaita-dark${color}${size}`); + t.is(variants.get('day'), `Macwaita${color}${size}`); + t.is(variants.get('night'), `Macwaita-dark${color}${size}`); + }); + }); +});