async function apply(id, init) {
	if (!DOES_SUPPORT_THEME) {
		id = "default";
	}

	themeApplied = true;
	const loaderFile = Url.join(ASSETS_DIRECTORY, "res/tail-spin.svg");
	const svgName = "__tail-spin__.svg";
	const img = Url.join(DATA_STORAGE, svgName);
	const theme = get(id);
	const $style = document.head.get("style#app-theme") ?? (
		<style id="app-theme"></style>
	);
	const update = {
		appTheme: id,
	};

	if (id === "custom") {
		update.customTheme = theme.toJSON();
	}

	if (init && theme.preferredEditorTheme) {
		update.editorTheme = theme.preferredEditorTheme;
		if (editorManager != null && editorManager.editor != null) {
			editorManager.editor.setTheme(theme.preferredEditorTheme);
		}
	}

	if (init && theme.preferredFont) {
		update.editorFont = theme.preferredFont;
		fonts.setFont(theme.preferredFont);
	}

	settings.update(update, false);
	localStorage.__primary_color = theme.primaryColor;
	document.body.setAttribute("theme-type", theme.type);
	$style.textContent = theme.css;
	document.head.append($style);

	// Set status bar and navigation bar color
	system.setUiTheme(
		color(theme.primaryColor).hex.toString(),
		theme.toJSON("hex"),
	);

	try {
		let fs = fsOperation(loaderFile);
		const svg = await fs.readFile("utf8");

		fs = fsOperation(img);
		if (!(await fs.exists())) {
			await fsOperation(DATA_STORAGE).createFile(svgName);
		}
		await fs.writeFile(svg.replace(/#fff/g, theme.primaryColor));
	} catch (error) {
		window.log("error", error);
	}
}
Apply a theme
@param {string} id The name of the theme to apply
@param {boolean} init Whether or not this is the first time the theme is being applied