This commit is contained in:
wdvipa
2026-02-09 16:30:59 +08:00
commit 52c6322a24
2780 changed files with 166403 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import ThemeCache from "./ThemeCache";
import Theme from "./Theme";
var cacheThemes = new ThemeCache();
/**
* Same as new Theme, but will always return same one if `derivative` not changed.
*/
export default function createTheme(derivatives) {
var derivativeArr = Array.isArray(derivatives) ? derivatives : [derivatives];
// Create new theme if not exist
if (!cacheThemes.has(derivativeArr)) {
cacheThemes.set(derivativeArr, new Theme(derivativeArr));
}
// Get theme from cache and return
return cacheThemes.get(derivativeArr);
}