Add Cabinet theme support
This commit is contained in:
@@ -14,6 +14,7 @@ These themes have been tested and work:
|
||||
- Adwaita (GNOME & Fedora default)
|
||||
- Arc
|
||||
- Canta
|
||||
- Cabinet
|
||||
- ChromeOS
|
||||
- Flat-Remix-GTK
|
||||
- HighContrast
|
||||
|
||||
@@ -4,6 +4,7 @@ These themes have been tested and work:
|
||||
- Adapta
|
||||
- Adwaita (GNOME & Fedora default)
|
||||
- Arc
|
||||
- Cabinet
|
||||
- Canta
|
||||
- ChromeOS
|
||||
- Flat-Remix-GTK
|
||||
|
||||
@@ -52,9 +52,10 @@ var Variants = class {
|
||||
variants.set('day', name.replace('-Nokto', ''));
|
||||
variants.set('night', variants.get('day').replace('Adapta', 'Adapta-Nokto'));
|
||||
}
|
||||
else if ( name.includes('Arc') ) {
|
||||
else if ( name.match(/^(Arc|Cabinet)/) ) {
|
||||
const basename = name.split('-')[0];
|
||||
variants.set('day', name.replace(/-Dark(?!er)/, ''));
|
||||
variants.set('night', variants.get('day').replace(/Arc(-Darker)?/, 'Arc-Dark'));
|
||||
variants.set('night', variants.get('day').replace(new RegExp(`${basename}(-Darker)?`), `${basename}-Dark`));
|
||||
}
|
||||
else if ( name.match(/^(Canta|ChromeOS|Materia|Orchis).*-compact/) ) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
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 <http s ://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['Blue', 'Green', 'Orange'].forEach(color => {
|
||||
test(`Cabinet-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Cabinet-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
|
||||
test(`Cabinet-Dark-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Cabinet-Dark-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
|
||||
test(`Cabinet-Darker-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Cabinet-Darker-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-Darker-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user