From 9d58e973bb4bef723fa4bdc7e78ee86fe374612b Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 26 Jan 2025 21:50:51 -0500 Subject: [PATCH] Remove IRCColors From EquiPlugins --- README.md | 5 +- src/equicordplugins/ircColors/index.ts | 92 -------------------------- 2 files changed, 2 insertions(+), 95 deletions(-) delete mode 100644 src/equicordplugins/ircColors/index.ts diff --git a/README.md b/README.md index 0becfe08..32969b6b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch ### Extra included plugins
-149 additional plugins +148 additional plugins ### All Platforms - AllCallTimers by MaxHerbold & D3SOX @@ -77,7 +77,6 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - ImagePreview by Creations - ImgToGif by zyqunix - InRole by nin0dev -- IrcColors by Grzesiek11 - IRememberYou by zoodogood - Jumpscare by Surgedevs - JumpToStart by Samwich @@ -189,7 +188,7 @@ Linux - [AUR](https://aur.archlinux.org/packages?O=0&K=equicord) ```shell sh -c "$(curl -sS https://raw.githubusercontent.com/Equicord/Equicord/refs/heads/main/misc/install.sh)" -``` +``` ## Installing Equicord Devbuild ### Dependencies diff --git a/src/equicordplugins/ircColors/index.ts b/src/equicordplugins/ircColors/index.ts deleted file mode 100644 index 21c86381..00000000 --- a/src/equicordplugins/ircColors/index.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { definePluginSettings } from "@api/Settings"; -import { Devs } from "@utils/constants"; -import definePlugin, { OptionType } from "@utils/types"; - -// Compute a 64-bit FNV-1a hash of the passed data -function hash(data: ArrayBuffer) { - const fnvPrime = 1099511628211n; - const offsetBasis = 14695981039346656037n; - - let result = offsetBasis; - for (const byte of new Uint8Array(data)) { - result ^= BigInt(byte); - result = (result * fnvPrime) % 2n ** 32n; - } - - return result; -} - -// Calculate a CSS color string based on the user ID -function calculateNameColorForUser(id: bigint) { - const idBuffer = new ArrayBuffer(16); - { - const idView = new DataView(idBuffer); - idView.setBigUint64(0, id); - } - const idHash = hash(idBuffer); - - return `hsl(${idHash % 360n}, 100%, ${settings.store.lightness}%)`; -} - -const settings = definePluginSettings({ - lightness: { - description: "Lightness, in %. Change if the colors are too light or too dark.", - restartNeeded: true, - type: OptionType.NUMBER, - default: 70, - }, - memberListColors: { - description: "Replace role colors in the member list", - restartNeeded: true, - type: OptionType.BOOLEAN, - default: false, - }, -}); - -export default definePlugin({ - name: "IrcColors", - description: "Makes username colors in chat unique, like in IRC clients", - authors: [Devs.Grzesiek11], - patches: [ - { - find: "=\"SYSTEM_TAG\"", - replacement: { - match: /(?<=className:\i\.username,style:.{0,50}:void 0,)/, - replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])},", - }, - }, - { - find: ".NameWithRole,{roleName:", - replacement: { - match: /(?<=color:)null!=.{0,50}?(?=,)/, - replace: "$self.calculateNameColorForListContext(arguments[0])", - }, - predicate: () => settings.store.memberListColors, - }, - ], - settings, - calculateNameColorForMessageContext(context: any) { - return calculateNameColorForUser(BigInt(context.message.author.id)); - }, - calculateNameColorForListContext(context: any) { - return calculateNameColorForUser(BigInt(context.user.id)); - }, -});