This commit is contained in:
thororen1234 2025-05-30 12:11:53 -04:00
parent ca157b33f7
commit 11dc0e9ea6
No known key found for this signature in database
6 changed files with 23 additions and 35 deletions

View file

@ -11,7 +11,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
### Extra included plugins ### Extra included plugins
<details> <details>
<summary>182 additional plugins</summary> <summary>183 additional plugins</summary>
### All Platforms ### All Platforms
@ -41,6 +41,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
- CommandPalette by Ethan - CommandPalette by Ethan
- CopyStickerLinks by Byeoon - CopyStickerLinks by Byeoon
- CopyUserMention by Cortex & castdrian - CopyUserMention by Cortex & castdrian
- CustomFolderIcons by sadan
- CustomSounds by TheKodeToad & SpikeHD - CustomSounds by TheKodeToad & SpikeHD
- CustomTimestamps by Rini & nvhrr - CustomTimestamps by Rini & nvhrr
- CustomUserColors by mochienya - CustomUserColors by mochienya

View file

@ -1,14 +0,0 @@
# CustomFolderIcons
Allows you to set custom images/svgs as folder icons
Available as "Change Icon" in the folder context menu
![the context menu with the "Change Icon" button](https://github.com/sadan4/Vencord/assets/117494111/3dfb843c-6964-4ac3-a0b9-8772569953d3)
![an image of some example custom folder icons](https://github.com/sadan4/Vencord/assets/117494111/c5324ab1-3b7a-4286-8cb5-41c0ceb2ea44)
![the modal used to customize the folder icons](https://github.com/sadan4/Vencord/assets/117494111/1426d350-56db-4687-8052-6c1b1ce873a1)

View file

@ -7,7 +7,7 @@
import { closeModal, ModalContent, ModalHeader, ModalRoot, openModalLazy } from "@utils/modal"; import { closeModal, ModalContent, ModalHeader, ModalRoot, openModalLazy } from "@utils/modal";
import { Button, Menu, Slider, TextInput, useState } from "@webpack/common"; import { Button, Menu, Slider, TextInput, useState } from "@webpack/common";
import settings, { folderIconsData } from "./settings"; import { folderIconsData, settings } from "./settings";
import { folderProp, int2rgba, setFolderData } from "./util"; import { folderProp, int2rgba, setFolderData } from "./util";
export function ImageModal(folderProps: folderProp) { export function ImageModal(folderProps: folderProp) {
@ -81,7 +81,7 @@ export function RenderPreview({ folderProps, url, size }: { folderProps: folderP
justifyContent: "center", justifyContent: "center",
alignItems: "center" alignItems: "center"
}}> }}>
<img src={url} width={`${size}%`} height={`${size}%`} /> <img alt="" src={url} width={`${size}%`} height={`${size}%`} />
</div> </div>
); );
} }

View file

@ -8,14 +8,14 @@ import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { makeContextItem } from "./components"; import { makeContextItem } from "./components";
import settings, { folderIconsData } from "./settings"; import { folderIconsData, settings } from "./settings";
import { folderProp, int2rgba } from "./util"; import { folderProp, int2rgba } from "./util";
export default definePlugin({ export default definePlugin({
settings,
name: "CustomFolderIcons", name: "CustomFolderIcons",
description: "Customize folder icons with any png", description: "Customize folder icons with any png",
authors: [EquicordDevs.sadan], authors: [EquicordDevs.sadan],
settings,
patches: [ patches: [
{ {
find: ".folderButtonInner", find: ".folderButtonInner",
@ -49,7 +49,7 @@ export default definePlugin({
height: "100%" height: "100%"
}} }}
> >
<img src={data!.url} width={`${data!.size ?? 100}%`} height={`${data!.size ?? 100}%`} <img alt="" src={data!.url} width={`${data!.size ?? 100}%`} height={`${data!.size ?? 100}%`}
/> />
</div> </div>
); );

View file

@ -13,7 +13,7 @@ export interface folderIcon{
} }
export type folderIconsData = Record<string, folderIcon | null>; export type folderIconsData = Record<string, folderIcon | null>;
const settings = definePluginSettings({ export const settings = definePluginSettings({
solidIcon: { solidIcon: {
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
default: false, default: false,
@ -26,4 +26,3 @@ const settings = definePluginSettings({
component: () => <></> component: () => <></>
} }
}); });
export default settings;

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import settings, { folderIcon, folderIconsData } from "./settings"; import { folderIcon, folderIconsData, settings } from "./settings";
export async function setFolderData(props: folderProp, newData: folderIcon) { export async function setFolderData(props: folderProp, newData: folderIcon) {
if (!settings.store.folderIcons) { if (!settings.store.folderIcons) {
@ -13,10 +13,12 @@ export async function setFolderData(props: folderProp, newData: folderIcon) {
const folderSettings = (settings.store.folderIcons as folderIconsData); const folderSettings = (settings.store.folderIcons as folderIconsData);
folderSettings[props.folderId] = newData; folderSettings[props.folderId] = newData;
} }
export interface folderProp { export interface folderProp {
folderId: string; folderId: string;
folderColor: number; folderColor: number;
} }
/** /**
* @param rgbVal RGB value * @param rgbVal RGB value
* @param alpha alpha bewteen zero and 1 * @param alpha alpha bewteen zero and 1