Equicord/src/equicordplugins/themeLibrary/index.tsx

55 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-05-04 00:50:59 -04:00
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
2025-12-06 00:01:38 -05:00
import { ColorPaletteIcon } from "@components/Icons";
import SettingsPlugin, { settingsSectionMap } from "@plugins/_core/settings";
2024-10-10 20:05:41 -04:00
import { EquicordDevs } from "@utils/constants";
2024-10-10 20:02:24 -04:00
import definePlugin from "@utils/types";
import { openUserSettingsPanel } from "@webpack/common";
2024-10-10 20:02:24 -04:00
import { settings } from "./utils/settings";
export default definePlugin({
name: "ThemeLibrary",
description: "A library of themes for Vencord.",
2024-10-10 20:05:41 -04:00
authors: [EquicordDevs.Fafa],
2024-10-10 20:02:24 -04:00
settings,
toolboxActions: {
"Open Theme Library": () => {
openUserSettingsPanel("theme_library");
2024-10-10 20:02:24 -04:00
},
},
start() {
2025-12-06 19:34:36 -05:00
const { customEntries, customSections } = SettingsPlugin;
2024-10-10 20:02:24 -04:00
2025-12-06 19:34:36 -05:00
customEntries.push({
key: "equicord_theme_library",
2025-12-06 00:01:38 -05:00
title: "Theme Library",
Component: require("./components/ThemeTab").default,
Icon: ColorPaletteIcon
});
2025-12-06 19:34:36 -05:00
customSections.push(() => ({
section: "EquicordThemeLibrary",
label: "Theme Library",
searchableTitles: ["Theme Library"],
element: require("./components/ThemeTab").default,
id: "ThemeLibrary",
}));
settingsSectionMap.push(["EquicordThemeLibrary", "equicord_theme_library"]);
2024-10-10 20:02:24 -04:00
},
stop() {
2025-12-06 19:34:36 -05:00
const { customEntries, customSections } = SettingsPlugin;
const entry = customEntries.findIndex(entry => entry.key === "equicord_theme_library");
const section = customSections.findIndex(section => section({} as any).id === "ThemeLibrary");
if (entry !== -1) customEntries.splice(entry, 1);
if (section !== -1) customSections.splice(section, 1);
2024-10-10 20:02:24 -04:00
},
});