Equicord/src/equicordplugins/customFolderIcons/util.tsx
vMohammad db7447a93d
add folder icons by sadan (#274)
* fixed and added custom folder icons by sadan

* better regex

* better regex

* Fixes

---------

Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com>
2025-05-30 12:12:34 -04:00

31 lines
849 B
TypeScript

/*
* Vencord, a Discord client mod
* Copyright (c) 2024 sadan
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { folderIcon, folderIconsData, settings } from "./settings";
export async function setFolderData(props: folderProp, newData: folderIcon) {
if (!settings.store.folderIcons) {
settings.store.folderIcons = {};
}
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
*/
export function int2rgba(rgbVal: number, alpha: number = 1) {
const b = rgbVal & 0xFF,
g = (rgbVal & 0xFF00) >>> 8,
r = (rgbVal & 0xFF0000) >>> 16;
return `rgba(${[r, g, b].join(",")},${alpha})`;
}