Equicord/src/equicordplugins/themeLibrary/index.tsx

59 lines
1.5 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
*/
2024-07-07 00:38:05 -04:00
import definePlugin from "@utils/types";
2024-05-12 17:43:11 -04:00
import { SettingsRouter } from "@webpack/common";
2024-07-07 00:38:05 -04:00
import { settings } from "./settings";
2024-05-04 00:50:59 -04:00
export default definePlugin({
2024-05-12 17:43:11 -04:00
name: "ThemeLibrary",
2024-05-04 00:50:59 -04:00
description: "A library of themes for Vencord.",
2024-07-07 00:38:05 -04:00
authors: [
{
name: "Fafa",
id: 428188716641812481n,
},
],
2024-05-12 17:43:11 -04:00
settings,
toolboxActions: {
"Open Theme Library": () => {
SettingsRouter.open("ThemeLibrary");
},
2024-05-12 17:43:11 -04:00
},
2024-05-04 00:50:59 -04:00
start() {
const customSettingsSections = (
Vencord.Plugins.plugins.Settings as any as {
customSections: ((ID: Record<string, unknown>) => any)[];
}
2024-05-04 00:50:59 -04:00
).customSections;
const ThemeSection = () => ({
section: "ThemeLibrary",
label: "Theme Library",
element: require("./components/ThemeTab").default,
id: "ThemeSection",
2024-05-04 00:50:59 -04:00
});
customSettingsSections.push(ThemeSection);
},
stop() {
const customSettingsSections = (
Vencord.Plugins.plugins.Settings as any as {
customSections: ((ID: Record<string, unknown>) => any)[];
}
2024-05-04 00:50:59 -04:00
).customSections;
const i = customSettingsSections.findIndex(
section => section({}).id === "ThemeSection"
);
2024-05-04 00:50:59 -04:00
if (i !== -1) customSettingsSections.splice(i, 1);
2024-05-12 17:43:11 -04:00
},
2024-05-04 00:50:59 -04:00
});