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
<details>
<summary>182 additional plugins</summary>
<summary>183 additional plugins</summary>
### All Platforms
@ -41,6 +41,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
- CommandPalette by Ethan
- CopyStickerLinks by Byeoon
- CopyUserMention by Cortex & castdrian
- CustomFolderIcons by sadan
- CustomSounds by TheKodeToad & SpikeHD
- CustomTimestamps by Rini & nvhrr
- 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 { Button, Menu, Slider, TextInput, useState } from "@webpack/common";
import settings, { folderIconsData } from "./settings";
import { folderIconsData, settings } from "./settings";
import { folderProp, int2rgba, setFolderData } from "./util";
export function ImageModal(folderProps: folderProp) {
@ -81,7 +81,7 @@ export function RenderPreview({ folderProps, url, size }: { folderProps: folderP
justifyContent: "center",
alignItems: "center"
}}>
<img src={url} width={`${size}%`} height={`${size}%`} />
<img alt="" src={url} width={`${size}%`} height={`${size}%`} />
</div>
);
}

View file

@ -8,14 +8,14 @@ import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
import { makeContextItem } from "./components";
import settings, { folderIconsData } from "./settings";
import { folderIconsData, settings } from "./settings";
import { folderProp, int2rgba } from "./util";
export default definePlugin({
settings,
name: "CustomFolderIcons",
description: "Customize folder icons with any png",
authors: [EquicordDevs.sadan],
settings,
patches: [
{
find: ".folderButtonInner",
@ -49,7 +49,7 @@ export default definePlugin({
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>
);

View file

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

View file

@ -4,7 +4,7 @@
* 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) {
if (!settings.store.folderIcons) {
@ -13,10 +13,12 @@ export async function setFolderData(props: folderProp, newData: folderIcon) {
const folderSettings = (settings.store.folderIcons as folderIconsData);
folderSettings[props.folderId] = newData;
}
export interface folderProp {
folderId: string;
folderColor: number;
}
/**
* @param rgbVal RGB value
* @param alpha alpha bewteen zero and 1