Skip to content

Commit 76900f0

Browse files
authored
Add default theme support
1 parent eb0b296 commit 76900f0

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

TangerineUI.user.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// @updateURL https://github.com/Write/TangerineUI-Userscript/raw/main/TangerineUI.user.js
1313
// @homepageURL https://github.com/Write/TangerineUI-Userscript
1414
// @grant none
15-
// @version 2.2.4.1
15+
// @version 2.2.4.2
1616
// @author @Write on Github for the UserScript
1717
// @author @nileane for TangerineUI's CSS
1818
// @run-at document-start
@@ -22,6 +22,14 @@
2222
/* ----------------
2323
* SETTINGS
2424
* ---------------- */
25+
/* Default themes for hosts not configured in perHostThemes */
26+
/* These will be used as fallback for any Mastodon instance not explicitly configured below */
27+
/* Available themes: 'tangerine', 'purple', 'cherry', 'lagoon' */
28+
const defaultThemes = {
29+
legacy: 'tangerine', // For versions < 4.3.0
30+
modern: 'cherry' // For versions >= 4.3.0
31+
};
32+
2533
/* Per-host theme configuration */
2634
/* Set specific themes for different Mastodon instances */
2735
/* Available themes: 'tangerine', 'purple', 'cherry', 'lagoon' */
@@ -53,13 +61,10 @@
5361
// Add more hosts as needed
5462
};
5563

56-
/* Default fallback themes (used if host is not configured above) */
57-
/* colorScheme used for older (< 4.3) instances */
58-
/* Either 'tangerine' or 'purple' */
59-
const legacyColorScheme = 'tangerine';
60-
/* colorScheme used for new (>= 4.3) instances */
61-
/* Either 'tangerine', 'purple', 'cherry' or 'lagoon' */
62-
const colorScheme = 'cherry';
64+
/* Legacy fallback variables (kept for compatibility) */
65+
/* These are now derived from defaultThemes above */
66+
const legacyColorScheme = defaultThemes.legacy;
67+
const colorScheme = defaultThemes.modern;
6368
/* Github tags to use for different mastodon version ranges
6469
/* To find tags name, go here : https://github.com/nileane/TangerineUI-for-Mastodon/releases
6570
/* and look at the tag name in the left sidebar of the release
@@ -86,8 +91,8 @@
8691
log(`Using ${isLegacy ? 'legacy' : 'modern'} theme '${selectedTheme}' for host: ${currentHost}`);
8792
return selectedTheme;
8893
} else {
89-
const fallbackTheme = isLegacy ? legacyColorScheme : colorScheme;
90-
log(`Host '${currentHost}' not configured, using fallback ${isLegacy ? 'legacy' : 'modern'} theme: ${fallbackTheme}`);
94+
const fallbackTheme = isLegacy ? defaultThemes.legacy : defaultThemes.modern;
95+
log(`Host '${currentHost}' not configured, using default ${isLegacy ? 'legacy' : 'modern'} theme: ${fallbackTheme}`);
9196
return fallbackTheme;
9297
}
9398
}

0 commit comments

Comments
 (0)