From bef7dc94888a56889ff9fc7994613a5f8a93d11b Mon Sep 17 00:00:00 2001 From: thororen <78185467+thororen1234@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:45:24 -0400 Subject: [PATCH] Fix Timezones & Drop Colorways For Now --- README.md | 1 - .../discordColorways/colorwaysAPI.ts | 18 - .../components/AutoColorwaySelector.tsx | 68 - .../components/ColorPicker.tsx | 86 - .../ColorwayCreatorSettingsModal.tsx | 73 - .../components/ColorwayID.tsx | 117 -- .../components/ColorwaysButton.tsx | 61 - .../components/ConflictingColorsModal.tsx | 321 --- .../components/CreatorModal.tsx | 363 ---- .../components/FiltersMenu.tsx | 87 - .../discordColorways/components/Icons.tsx | 549 ----- .../discordColorways/components/InfoModal.tsx | 252 --- .../components/InputColorwayIdModal.tsx | 55 - .../discordColorways/components/MainModal.tsx | 114 - .../components/PCSMigrationModal.tsx | 35 - .../components/ReloadButton.tsx | 101 - .../components/SaveColorwayModal.tsx | 190 -- .../discordColorways/components/Selector.tsx | 563 ----- .../discordColorways/components/Setting.tsx | 26 - .../components/SettingsTabs/OnDemandPage.tsx | 102 - .../components/SettingsTabs/SettingsPage.tsx | 280 --- .../components/SettingsTabs/SourceManager.tsx | 415 ---- .../components/SettingsTabs/Store.tsx | 146 -- .../components/SourcesMenu.tsx | 63 - .../discordColorways/components/Spinner.tsx | 17 - .../discordColorways/components/Switch.tsx | 78 - .../discordColorways/components/TabBar.tsx | 28 - .../components/ThemePreview.tsx | 147 -- .../discordColorways/components/Tooltip.tsx | 63 - .../components/UseRepainterThemeModal.tsx | 57 - .../discordColorways/constants.ts | 317 --- src/equicordplugins/discordColorways/css.ts | 1027 --------- .../discordColorways/defaultsLoader.tsx | 117 -- .../discordColorways/index.tsx | 267 --- .../discordColorways/style.css | 1847 ----------------- .../discordColorways/theme.discord.css | 334 --- src/equicordplugins/discordColorways/types.ts | 77 - src/equicordplugins/discordColorways/utils.ts | 231 --- .../discordColorways/wsClient.ts | 229 -- src/equicordplugins/timezones/index.tsx | 2 +- 40 files changed, 1 insertion(+), 8923 deletions(-) delete mode 100644 src/equicordplugins/discordColorways/colorwaysAPI.ts delete mode 100644 src/equicordplugins/discordColorways/components/AutoColorwaySelector.tsx delete mode 100644 src/equicordplugins/discordColorways/components/ColorPicker.tsx delete mode 100644 src/equicordplugins/discordColorways/components/ColorwayCreatorSettingsModal.tsx delete mode 100644 src/equicordplugins/discordColorways/components/ColorwayID.tsx delete mode 100644 src/equicordplugins/discordColorways/components/ColorwaysButton.tsx delete mode 100644 src/equicordplugins/discordColorways/components/ConflictingColorsModal.tsx delete mode 100644 src/equicordplugins/discordColorways/components/CreatorModal.tsx delete mode 100644 src/equicordplugins/discordColorways/components/FiltersMenu.tsx delete mode 100644 src/equicordplugins/discordColorways/components/Icons.tsx delete mode 100644 src/equicordplugins/discordColorways/components/InfoModal.tsx delete mode 100644 src/equicordplugins/discordColorways/components/InputColorwayIdModal.tsx delete mode 100644 src/equicordplugins/discordColorways/components/MainModal.tsx delete mode 100644 src/equicordplugins/discordColorways/components/PCSMigrationModal.tsx delete mode 100644 src/equicordplugins/discordColorways/components/ReloadButton.tsx delete mode 100644 src/equicordplugins/discordColorways/components/SaveColorwayModal.tsx delete mode 100644 src/equicordplugins/discordColorways/components/Selector.tsx delete mode 100644 src/equicordplugins/discordColorways/components/Setting.tsx delete mode 100644 src/equicordplugins/discordColorways/components/SettingsTabs/OnDemandPage.tsx delete mode 100644 src/equicordplugins/discordColorways/components/SettingsTabs/SettingsPage.tsx delete mode 100644 src/equicordplugins/discordColorways/components/SettingsTabs/SourceManager.tsx delete mode 100644 src/equicordplugins/discordColorways/components/SettingsTabs/Store.tsx delete mode 100644 src/equicordplugins/discordColorways/components/SourcesMenu.tsx delete mode 100644 src/equicordplugins/discordColorways/components/Spinner.tsx delete mode 100644 src/equicordplugins/discordColorways/components/Switch.tsx delete mode 100644 src/equicordplugins/discordColorways/components/TabBar.tsx delete mode 100644 src/equicordplugins/discordColorways/components/ThemePreview.tsx delete mode 100644 src/equicordplugins/discordColorways/components/Tooltip.tsx delete mode 100644 src/equicordplugins/discordColorways/components/UseRepainterThemeModal.tsx delete mode 100644 src/equicordplugins/discordColorways/constants.ts delete mode 100644 src/equicordplugins/discordColorways/css.ts delete mode 100644 src/equicordplugins/discordColorways/defaultsLoader.tsx delete mode 100644 src/equicordplugins/discordColorways/index.tsx delete mode 100644 src/equicordplugins/discordColorways/style.css delete mode 100644 src/equicordplugins/discordColorways/theme.discord.css delete mode 100644 src/equicordplugins/discordColorways/types.ts delete mode 100644 src/equicordplugins/discordColorways/utils.ts delete mode 100644 src/equicordplugins/discordColorways/wsClient.ts diff --git a/README.md b/README.md index 2f2c4977..67f34d11 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,6 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - CutePats by thororen - DeadMembers by Kyuuhachi - Demonstration by Samwich -- DiscordColorways by DaBluLite - DNDWhilePlaying by thororen - DoNotLeak by Perny - DontFilterMe by Samwich diff --git a/src/equicordplugins/discordColorways/colorwaysAPI.ts b/src/equicordplugins/discordColorways/colorwaysAPI.ts deleted file mode 100644 index 67fdff32..00000000 --- a/src/equicordplugins/discordColorways/colorwaysAPI.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -export const ColorwayCSS = { - get: () => document.getElementById("activeColorwayCSS")!.textContent || "", - set: (e: string) => { - if (!document.getElementById("activeColorwayCSS")) { - document.head.append(Object.assign(document.createElement("style"), { - id: "activeColorwayCSS", - textContent: e - })); - } else (document.getElementById("activeColorwayCSS") as any).textContent = e; - }, - remove: () => document.getElementById("activeColorwayCSS")?.remove(), -}; diff --git a/src/equicordplugins/discordColorways/components/AutoColorwaySelector.tsx b/src/equicordplugins/discordColorways/components/AutoColorwaySelector.tsx deleted file mode 100644 index e949a488..00000000 --- a/src/equicordplugins/discordColorways/components/AutoColorwaySelector.tsx +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, useEffect, useState } from "../"; -import { getAutoPresets } from "../css"; -import { ModalProps } from "../types"; - -export default function ({ modalProps, onChange, autoColorwayId = "" }: { modalProps: ModalProps, onChange: (autoPresetId: string) => void, autoColorwayId: string; }) { - const [autoId, setAutoId] = useState(autoColorwayId); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - return
-

- Auto Preset Settings -

-
-
- About the Auto Colorway - The auto colorway allows you to use your system's accent color in combination with a selection of presets that will fully utilize it. -
-
- Presets: - {Object.values(getAutoPresets()).map(autoPreset =>
{ - setAutoId(autoPreset.id); - }}> - - {autoPreset.name} -
)} -
-
-
- - -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/ColorPicker.tsx b/src/equicordplugins/discordColorways/components/ColorPicker.tsx deleted file mode 100644 index 0c020e58..00000000 --- a/src/equicordplugins/discordColorways/components/ColorPicker.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, Toasts, useEffect, useState } from ".."; -import { mainColors } from "../constants"; -import { colorVariables } from "../css"; -import { ModalProps } from "../types"; -import { getHex } from "../utils"; -import { CopyIcon } from "./Icons"; - -export default function ({ modalProps }: { modalProps: ModalProps; }) { - const [ColorVars, setColorVars] = useState(colorVariables); - const [collapsedSettings, setCollapsedSettings] = useState(true); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - let results: string[]; - function searchToolboxItems(e: string) { - results = []; - colorVariables.find((colorVariable: string) => { - if (colorVariable.toLowerCase().includes(e.toLowerCase())) { - results.push(colorVariable); - } - }); - setColorVars(results); - } - - return
-
- { - searchToolboxItems(value); - if (value) { - setCollapsedSettings(false); - } else { - setCollapsedSettings(true); - } - }} - /> - -
-
- {ColorVars.map((colorVariable: string) =>
{ - navigator.clipboard.writeText(getHex(getComputedStyle(document.body).getPropertyValue("--" + colorVariable))); - Toasts.show({ message: "Color " + colorVariable + " copied to clipboard", id: "toolbox-color-var-copied", type: 1 }); - }} style={{ "--brand-experiment": `var(--${colorVariable})` } as React.CSSProperties}> - {`Copy ${colorVariable}`} -
)} -
-
- {mainColors.map(mainColor =>
- { - navigator.clipboard.writeText(getHex(getComputedStyle(document.body).getPropertyValue(mainColor.var))); - Toasts.show({ message: `${mainColor.title} color copied to clipboard`, id: `toolbox-${mainColor.name}-color-copied`, type: 1 }); - }} width={20} height={20} className="colorwayToolbox-listItemSVG" /> - {`Copy ${mainColor.title} Color`} -
- )} -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/ColorwayCreatorSettingsModal.tsx b/src/equicordplugins/discordColorways/components/ColorwayCreatorSettingsModal.tsx deleted file mode 100644 index 4be57145..00000000 --- a/src/equicordplugins/discordColorways/components/ColorwayCreatorSettingsModal.tsx +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, useEffect, useState } from ".."; -import { getPreset } from "../css"; -import { ModalProps } from "../types"; -import Setting from "./Setting"; -import Switch from "./Switch"; - -export default function ({ modalProps, onSettings, presetId, hasTintedText, hasDiscordSaturation }: { modalProps: ModalProps, presetId: string, hasTintedText: boolean, hasDiscordSaturation: boolean, onSettings: ({ presetId, tintedText, discordSaturation }: { presetId: string, tintedText: boolean, discordSaturation: boolean; }) => void; }) { - const [tintedText, setTintedText] = useState(hasTintedText); - const [discordSaturation, setDiscordSaturation] = useState(hasDiscordSaturation); - const [preset, setPreset] = useState(presetId); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - return
-

Creator Settings

-
- - Presets: - -
- {Object.values(getPreset()).map(pre =>
{ - setPreset(pre.id); - }}> - - {pre.name} -
)} -
- - - - -
-
- - -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/ColorwayID.tsx b/src/equicordplugins/discordColorways/components/ColorwayID.tsx deleted file mode 100644 index 43c835e1..00000000 --- a/src/equicordplugins/discordColorways/components/ColorwayID.tsx +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, openModal, Toasts, useEffect, useState } from ".."; -import { ColorwayCSS } from "../colorwaysAPI"; -import { generateCss } from "../css"; -import { colorToHex, hexToString } from "../utils"; -import CreatorModal from "./CreatorModal"; - -export let changeThemeIDCard: (theme: string) => void = () => { }; - -export default function ({ props }) { - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - changeThemeIDCard = theme => setTheme(theme); - load(); - return () => { - changeThemeIDCard = () => { }; - }; - }, []); - if (String(props.message.content).match(/colorway:[0-9a-f]{0,100}/)) { - return
- {String(props.message.content).match(/colorway:[0-9a-f]{0,100}/g)?.map((colorID: string) => { - colorID = hexToString(colorID.split("colorway:")[1]); - return
-
- {(() => { - if (colorID) { - if (!colorID.includes(",")) { - throw new Error("Invalid Colorway ID"); - } else { - return colorID.split("|").filter(string => string.includes(",#"))[0].split(/,#/).map((color: string) =>
); - } - } else return null; - })()} -
-
- Colorway{/n:([A-Za-z0-9]+( [A-Za-z0-9]+)+)/i.exec(colorID) ? `: ${/n:([A-Za-z0-9]+( [A-Za-z0-9]+)+)/i.exec(colorID)![1]}` : ""} -
- - - -
-
-
; - })} -
; - } else { - return null; - } -} diff --git a/src/equicordplugins/discordColorways/components/ColorwaysButton.tsx b/src/equicordplugins/discordColorways/components/ColorwaysButton.tsx deleted file mode 100644 index 93e59d21..00000000 --- a/src/equicordplugins/discordColorways/components/ColorwaysButton.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, FluxDispatcher, FluxEvents, openModal, useEffect, useState } from ".."; -import { getAutoPresets } from "../css"; -import { ColorwayObject } from "../types"; -import { PalleteIcon } from "./Icons"; -import Selector from "./MainModal"; -import Tooltip from "./Tooltip"; - -export default function () { - const [activeColorway, setActiveColorway] = useState("None"); - const [visibility, setVisibility] = useState(true); - const [isThin, setIsThin] = useState(false); - const [autoPreset, setAutoPreset] = useState("hueRotation"); - useEffect(() => { - (async function () { - setVisibility(await DataStore.get("showColorwaysButton") as boolean); - setIsThin(await DataStore.get("useThinMenuButton") as boolean); - setAutoPreset(await DataStore.get("activeAutoPreset") as string); - })(); - }); - - FluxDispatcher.subscribe("COLORWAYS_UPDATE_BUTTON_HEIGHT" as FluxEvents, ({ isTall }) => { - setIsThin(isTall); - }); - - FluxDispatcher.subscribe("COLORWAYS_UPDATE_BUTTON_VISIBILITY" as FluxEvents, ({ isVisible }) => { - setVisibility(isVisible); - }); - - return - {!isThin ? <> - Colorways - {"Active Colorway: " + activeColorway} - : {"Active Colorway: " + activeColorway}} - {activeColorway === "Auto" ? {"Auto Preset: " + (getAutoPresets()[autoPreset].name || "None")} : <>} - - } position="right" - > - {({ onMouseEnter, onMouseLeave, onClick }) => visibility ?
-
{ - onMouseEnter(); - setActiveColorway((await DataStore.get("activeColorwayObject") as ColorwayObject).id || "None"); - setAutoPreset(await DataStore.get("activeAutoPreset") as string); - }} - onMouseLeave={onMouseLeave} - onClick={() => { - onClick(); - openModal((props: any) => ); - }} - >{isThin ? Colorways : }
-
: <>} -
; -} diff --git a/src/equicordplugins/discordColorways/components/ConflictingColorsModal.tsx b/src/equicordplugins/discordColorways/components/ConflictingColorsModal.tsx deleted file mode 100644 index e6bc1c52..00000000 --- a/src/equicordplugins/discordColorways/components/ConflictingColorsModal.tsx +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, useEffect, useState } from ".."; -import { knownThemeVars } from "../constants"; -import { ModalProps } from "../types"; -import { getFontOnBg, getHex } from "../utils"; - -export default function ({ - modalProps, - onFinished -}: { - modalProps: ModalProps; - onFinished: ({ accent, primary, secondary, tertiary }: { accent: string, primary: string, secondary: string, tertiary: string; }) => void; -}) { - const [accentColor, setAccentColor] = useState(getHex( - getComputedStyle( - document.body - ).getPropertyValue("--brand-experiment") - )); - const [primaryColor, setPrimaryColor] = useState(getHex( - getComputedStyle( - document.body - ).getPropertyValue("--background-primary") - )); - const [secondaryColor, setSecondaryColor] = useState(getHex( - getComputedStyle( - document.body - ).getPropertyValue("--background-secondary") - )); - const [tertiaryColor, setTertiaryColor] = useState(getHex( - getComputedStyle( - document.body - ).getPropertyValue("--background-tertiary") - )); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - return
-

- Conflicting Colors Found -

-
- Multiple known themes have been found, select the colors you want to copy from below: - Colors to copy: -
-
Primary
-
Secondary
-
Tertiary
-
Accent
-
-
-
-
- Discord -
-
setPrimaryColor( - getHex( - getComputedStyle( - document.body - ).getPropertyValue("--background-primary") - ) - )} - >Primary
-
setSecondaryColor( - getHex( - getComputedStyle( - document.body - ).getPropertyValue("--background-secondary") - ) - )} - >Secondary
-
setTertiaryColor( - getHex( - getComputedStyle( - document.body - ).getPropertyValue("--background-tertiary") - ) - )} - >Tertiary
-
setAccentColor( - getHex( - getComputedStyle( - document.body - ).getPropertyValue("--brand-experiment") - ) - )} - >Accent
-
-
- {Object.values(knownThemeVars).map((theme: any, i) => { - if (getComputedStyle(document.body).getPropertyValue(theme.variable)) { - return ( -
- {Object.keys(knownThemeVars)[i] + (theme.alt ? " (Main)" : "")} -
- {theme.primary && getComputedStyle(document.body).getPropertyValue(theme.primary).match(/^\d.*%$/) - ?
{ - setPrimaryColor(getHex(`hsl(${getComputedStyle(document.body).getPropertyValue(theme.primary)})`)); - }} - >Primary
- : ( - theme.primary - ?
{ - setPrimaryColor(getHex(getComputedStyle(document.body).getPropertyValue(theme.primary))); - }} - >Primary
- : (theme.primaryVariables - &&
{ - setPrimaryColor(getHex(`hsl(${getComputedStyle(document.body).getPropertyValue(theme.primaryVariables.h)} ${!getComputedStyle(document.body).getPropertyValue(theme.primaryVariables.s).includes("%") ? (getComputedStyle(document.body).getPropertyValue(theme.primaryVariables.s) + "%") : getComputedStyle(document.body).getPropertyValue(theme.primaryVariables.s)} ${!getComputedStyle(document.body).getPropertyValue(theme.primaryVariables.l).includes("%") ? (getComputedStyle(document.body).getPropertyValue(theme.primaryVariables.l) + "%") : getComputedStyle(document.body).getPropertyValue(theme.primaryVariables.l)})`)); - }} - >Primary
)) - } - {theme.secondary && getComputedStyle(document.body).getPropertyValue(theme.secondary).match(/^\d.*%$/) - ?
{ - setSecondaryColor(getHex(`hsl(${getComputedStyle(document.body).getPropertyValue(theme.secondary)})`)); - }} - >Secondary
- : (theme.secondary - ?
{ - setSecondaryColor(getHex(getComputedStyle(document.body).getPropertyValue(theme.secondary))); - }} - >Secondary
- : (theme.secondaryVariables - &&
{ - setSecondaryColor(getHex(`hsl(${getComputedStyle(document.body).getPropertyValue(theme.secondaryVariables.h)} ${!getComputedStyle(document.body).getPropertyValue(theme.secondaryVariables.s).includes("%") ? (getComputedStyle(document.body).getPropertyValue(theme.secondaryVariables.s) + "%") : getComputedStyle(document.body).getPropertyValue(theme.secondaryVariables.s)} ${!getComputedStyle(document.body).getPropertyValue(theme.secondaryVariables.l).includes("%") ? (getComputedStyle(document.body).getPropertyValue(theme.secondaryVariables.l) + "%") : getComputedStyle(document.body).getPropertyValue(theme.secondaryVariables.l)})`)); - }} - >Secondary
)) - } - {theme.tertiary && getComputedStyle(document.body).getPropertyValue(theme.tertiary).match(/^\d.*%$/) - ?
{ - setTertiaryColor(getHex(`hsl(${getComputedStyle(document.body).getPropertyValue(theme.tertiary)})`)); - }} - >Tertiary
- : (theme.tertiary - ?
{ - setTertiaryColor(getHex(getComputedStyle(document.body).getPropertyValue(theme.tertiary))); - }} - >Tertiary
- : (theme.tertiaryVariables - &&
{ - setTertiaryColor(getHex(`hsl(${getComputedStyle(document.body).getPropertyValue(theme.tertiaryVariables.h)} ${!getComputedStyle(document.body).getPropertyValue(theme.tertiaryVariables.s).includes("%") ? (getComputedStyle(document.body).getPropertyValue(theme.tertiaryVariables.s) + "%") : getComputedStyle(document.body).getPropertyValue(theme.tertiaryVariables.s)} ${!getComputedStyle(document.body).getPropertyValue(theme.tertiaryVariables.l).includes("%") ? (getComputedStyle(document.body).getPropertyValue(theme.tertiaryVariables.l) + "%") : getComputedStyle(document.body).getPropertyValue(theme.tertiaryVariables.l)})`)); - }} - >Tertiary
))} - {theme.accent && getComputedStyle(document.body).getPropertyValue(theme.accent).match(/^\d.*%$/) - ?
{ - setAccentColor(getHex(`hsl(${getComputedStyle(document.body).getPropertyValue(theme.accent)})`)); - }} - >Accent
- : (theme.accent - ?
{ - setAccentColor(getHex(getComputedStyle(document.body).getPropertyValue(theme.accent))); - }} - >Accent
- : (theme.accentVariables - &&
{ - setAccentColor(getHex(`hsl(${getComputedStyle(document.body).getPropertyValue(theme.accentVariables.h)} ${!getComputedStyle(document.body).getPropertyValue(theme.accentVariables.s).includes("%") ? (getComputedStyle(document.body).getPropertyValue(theme.accentVariables.s) + "%") : getComputedStyle(document.body).getPropertyValue(theme.accentVariables.s)} ${!getComputedStyle(document.body).getPropertyValue(theme.accentVariables.l).includes("%") ? (getComputedStyle(document.body).getPropertyValue(theme.accentVariables.l) + "%") : getComputedStyle(document.body).getPropertyValue(theme.accentVariables.l)})`)); - }} - >Accent
))} -
-
- ); - } - })} -
-
-
-
- -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/CreatorModal.tsx b/src/equicordplugins/discordColorways/components/CreatorModal.tsx deleted file mode 100644 index 0826378b..00000000 --- a/src/equicordplugins/discordColorways/components/CreatorModal.tsx +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { ColorPicker, DataStore, openModal, PluginProps, Slider, useEffect, useReducer, UserStore, useState } from ".."; -import { knownThemeVars } from "../constants"; -import { generateCss, getPreset, gradientPresetIds, PrimarySatDiffs, pureGradientBase } from "../css"; -import { Colorway, ModalProps } from "../types"; -import { colorToHex, getHex, HexToHSL, hexToString } from "../utils"; -import { updateRemoteSources } from "../wsClient"; -import ColorwayCreatorSettingsModal from "./ColorwayCreatorSettingsModal"; -import ConflictingColorsModal from "./ConflictingColorsModal"; -import InputColorwayIdModal from "./InputColorwayIdModal"; -import SaveColorwayModal from "./SaveColorwayModal"; -import ThemePreviewCategory from "./ThemePreview"; -export default function ({ - modalProps, - loadUIProps = () => new Promise(() => { }), - colorwayID -}: { - modalProps: ModalProps; - loadUIProps?: () => Promise; - colorwayID?: string; -}) { - const [colors, updateColors] = useReducer((colors: { - accent: string, - primary: string, - secondary: string, - tertiary: string; - }, action: { - task: "accent" | "primary" | "secondary" | "tertiary" | "all", - color?: string; - colorObj?: { - accent: string, - primary: string, - secondary: string, - tertiary: string; - }; - }) => { - if (action.task === "all") { - return { ...action.colorObj } as { - accent: string, - primary: string, - secondary: string, - tertiary: string; - }; - } else { - return { ...colors, [action.task as "accent" | "primary" | "secondary" | "tertiary"]: action.color } as { - accent: string, - primary: string, - secondary: string, - tertiary: string; - }; - } - }, { - accent: "5865f2", - primary: "313338", - secondary: "2b2d31", - tertiary: "1e1f22" - }); - const [colorwayName, setColorwayName] = useState(""); - const [tintedText, setTintedText] = useState(true); - const [discordSaturation, setDiscordSaturation] = useState(true); - const [preset, setPreset] = useState("default"); - const [presetColorArray, setPresetColorArray] = useState(["accent", "primary", "secondary", "tertiary"]); - const [mutedTextBrightness, setMutedTextBrightness] = useState(Math.min(HexToHSL("#" + colors.primary)[2] + (3.6 * 3), 100)); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - const setColor = [ - "accent", - "primary", - "secondary", - "tertiary" - ] as ("accent" | "primary" | "secondary" | "tertiary")[]; - - const colorProps = [ - { - name: "Accent", - id: "accent" - }, - { - name: "Primary", - id: "primary" - }, - { - name: "Secondary", - id: "secondary" - }, - { - name: "Tertiary", - id: "tertiary" - } - ]; - - useEffect(() => { - if (colorwayID) { - if (!colorwayID.includes(",")) { - throw new Error("Invalid Colorway ID"); - } else { - colorwayID.split("|").forEach((prop: string) => { - if (prop.includes(",#")) { - prop.split(/,#/).forEach((color: string, i: number) => updateColors({ task: setColor[i], color: colorToHex(color) })); - } - if (prop.includes("n:")) { - setColorwayName(prop.split("n:")[1]); - } - if (prop.includes("p:")) { - if (Object.values(getPreset()).map(preset => preset.id).includes(prop.split("p:")[1])) { - setPreset(prop.split("p:")[1]); - setPresetColorArray(getPreset()[prop.split("p:")[1]].colors); - } - } - }); - } - } - }); - const colorPickerProps = { - suggestedColors: [ - "#313338", - "#2b2d31", - "#1e1f22", - "#5865f2", - ], - showEyeDropper: true - }; - - return ( -
-

Create a Colorway

-
- Name: - setColorwayName(e.currentTarget.value)} - /> -
- Colors & Values: -
- {colorProps.filter(color => presetColorArray.includes(color.id) || Object.keys(getPreset()[preset].calculated! || {}).includes(color.id)).map(presetColor => { - return {Object.keys(getPreset()[preset].calculated! || {}).includes(presetColor.id) ? (presetColor.name + " (Calculated)") : presetColor.name}} - color={!Object.keys( - getPreset()[preset].calculated! || {} - ).includes(presetColor.id) ? - parseInt(colors[presetColor.id], 16) : - parseInt( - colorToHex( - getPreset( - colors.primary, - colors.secondary, - colors.tertiary, - colors.accent - )[preset].calculated![presetColor.id] - ), - 16 - ) - } - onChange={(color: number) => { - if (!Object.keys(getPreset()[preset].calculated! || {}).includes(presetColor.id)) { - let hexColor = color.toString(16); - while (hexColor.length < 6) { - hexColor = "0" + hexColor; - } - updateColors({ task: presetColor.id as "accent" | "primary" | "secondary" | "tertiary", color: hexColor }); - } - }} - {...colorPickerProps} - />; - })} -
-
- Muted Text Brightness: - -
-
openModal((props: ModalProps) => { - setPreset(presetId); - setPresetColorArray(getPreset()[presetId].colors); - setDiscordSaturation(discordSaturation); - setTintedText(tintedText); - }} />)}> - Settings & Presets - -
- -
-
- - - - -
-
- ); -} - diff --git a/src/equicordplugins/discordColorways/components/FiltersMenu.tsx b/src/equicordplugins/discordColorways/components/FiltersMenu.tsx deleted file mode 100644 index 4adebcff..00000000 --- a/src/equicordplugins/discordColorways/components/FiltersMenu.tsx +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { MouseEvent } from "react"; - -import { useEffect, useState } from ".."; -import { SortOptions } from "../types"; -import { SortIcon } from "./Icons"; - -export default function ({ sort, onSortChange }: { sort: SortOptions, onSortChange: (newSort: SortOptions) => void; }) { - const [pos, setPos] = useState({ x: 0, y: 0 }); - const [showMenu, setShowMenu] = useState(false); - - function rightClickContextMenu(e: MouseEvent) { - e.stopPropagation(); - window.dispatchEvent(new Event("click")); - setShowMenu(!showMenu); - setPos({ - x: e.currentTarget.getBoundingClientRect().x, - y: e.currentTarget.getBoundingClientRect().y + e.currentTarget.offsetHeight + 8 - }); - } - function onPageClick(this: Window, e: globalThis.MouseEvent) { - setShowMenu(false); - } - - useEffect(() => { - window.addEventListener("click", onPageClick); - return () => { - window.removeEventListener("click", onPageClick); - }; - }, []); - - function onSortChange_internal(newSort: SortOptions) { - onSortChange(newSort); - setShowMenu(false); - } - - return <> - {showMenu ? : null} - - ; -} diff --git a/src/equicordplugins/discordColorways/components/Icons.tsx b/src/equicordplugins/discordColorways/components/Icons.tsx deleted file mode 100644 index 22fb5d92..00000000 --- a/src/equicordplugins/discordColorways/components/Icons.tsx +++ /dev/null @@ -1,549 +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 type { PropsWithChildren } from "react"; - -import { classes } from "../utils"; - -interface BaseIconProps extends IconProps { - viewBox: string; -} - -type IconProps = JSX.IntrinsicElements["svg"]; - -function Icon({ height = 24, width = 24, className, children, viewBox, ...svgProps }: PropsWithChildren) { - return ( - - {children} - - ); -} - -/** - * Discord's link icon, as seen in the Message context menu "Copy Message Link" option - */ -export function LinkIcon({ height = 24, width = 24, className }: IconProps) { - return ( - - - - - - - ); -} - -/** - * Discord's copy icon, as seen in the user popout right of the username when clicking - * your own username in the bottom left user panel - */ -export function CopyIcon(props: IconProps) { - return ( - - - - - - - ); -} - -/** - * Discord's open external icon, as seen in the user profile connections - */ -export function OpenExternalIcon(props: IconProps) { - return ( - - - - ); -} - -export function ImageIcon(props: IconProps) { - return ( - - - - ); -} - -export function InfoIcon(props: IconProps) { - return ( - - - - ); -} - -/** - * Discord's screenshare icon, as seen in the connection panel - */ -export function ScreenshareIcon(props: IconProps) { - return ( - - - - ); -} - -export function ImageVisible(props: IconProps) { - return ( - - - - ); -} - -export function ImageInvisible(props: IconProps) { - return ( - - - - ); -} - -export function Microphone(props: IconProps) { - return ( - - - - - ); -} - -export function CogWheel(props: IconProps) { - return ( - - - - ); -} - -export function ReplyIcon(props: IconProps) { - return ( - - - - ); -} - -export function DeleteIcon(props: IconProps) { - return ( - - - - - ); -} - -export function SearchIcon(props: IconProps) { - return ( - - - - ); -} -export function PlusIcon(props: IconProps) { - return ( - - - - ); -} - -export function CloseIcon(props: IconProps) { - return ( - - - - ); -} - -export function SwatchIcon(props: IconProps) { - return ( - - - - - ); -} - -export function PalleteIcon(props: IconProps) { - return ( - - - - ); -} - -export function NoEntrySignIcon(props: IconProps) { - return ( - - - - - ); -} - - -export function DownloadIcon(props: IconProps) { - return ( - - - - ); -} - -export function SafetyIcon(props: IconProps) { - return ( - - - - ); -} - -export function ImportIcon(props: IconProps) { - return ( - - - - ); -} - -export function IDIcon(props: IconProps) { - return ( - - - - - ); -} - -export function NotesIcon(props: IconProps) { - return ( - - - - - ); -} - -export function CodeIcon(props: IconProps) { - return ( - - - - ); -} - -export function MoreIcon(props: IconProps) { - return ( - - - - ); -} - -export function SortIcon(props: IconProps) { - return ( - - - - ); -} - -export function FolderIcon(props: IconProps) { - return ( - - - - ); -} - -export function LogIcon(props: IconProps) { - return ( - - - - ); -} - -export function RestartIcon(props: IconProps) { - return ( - - - - ); -} - -export function PaintbrushIcon(props: IconProps) { - return ( - - - - ); -} - -export function PencilIcon(props: IconProps) { - return ( - - - - ); -} - -export function InternetIcon(props: IconProps) { - return ( - - - - ); -} diff --git a/src/equicordplugins/discordColorways/components/InfoModal.tsx b/src/equicordplugins/discordColorways/components/InfoModal.tsx deleted file mode 100644 index 1f2200a9..00000000 --- a/src/equicordplugins/discordColorways/components/InfoModal.tsx +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, openModal, PluginProps, Toasts, useEffect, UserStore, useState, useStateFromStores } from ".."; -import { ColorwayCSS } from "../colorwaysAPI"; -import { generateCss, pureGradientBase } from "../css"; -import { Colorway, ModalProps } from "../types"; -import { colorToHex, saveFile, stringToHex } from "../utils"; -import SaveColorwayModal from "./SaveColorwayModal"; -import ThemePreview from "./ThemePreview"; - -function RenameColorwayModal({ modalProps, ogName, onFinish, colorwayList }: { modalProps: ModalProps, ogName: string, onFinish: (name: string) => void, colorwayList: Colorway[]; }) { - const [error, setError] = useState(""); - const [newName, setNewName] = useState(ogName); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - return
-

- Rename Colorway... -

-
- { - setNewName(value); - }} - /> -
-
- - -
-
; -} - -export default function ({ - modalProps, - colorway, - loadUIProps -}: { - modalProps: ModalProps; - colorway: Colorway; - loadUIProps: () => Promise; -}) { - const colors: string[] = colorway.colors || [ - "accent", - "primary", - "secondary", - "tertiary", - ]; - const profile = useStateFromStores([UserStore], () => UserStore.getUser(colorway.authorID)); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - return
-

- Colorway: {colorway.name} -

-
-
- Creator: -
- {} - { - navigator.clipboard.writeText(profile.username); - Toasts.show({ - message: "Copied Colorway Author Username Successfully", - type: 1, - id: "copy-colorway-author-username-notify", - }); - }}>{colorway.author} -
- Colors: -
- {colors.map(color =>
)} -
- Actions: -
- - - - {colorway.sourceType === "offline" && } - - - {colorway.sourceType === "offline" && } -
-
-
-
; -} diff --git a/src/equicordplugins/discordColorways/components/InputColorwayIdModal.tsx b/src/equicordplugins/discordColorways/components/InputColorwayIdModal.tsx deleted file mode 100644 index 8cbd68a0..00000000 --- a/src/equicordplugins/discordColorways/components/InputColorwayIdModal.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, useEffect, useState } from ".."; -import { ModalProps } from "../types"; -import { hexToString } from "../utils"; - -export default function ({ modalProps, onColorwayId }: { modalProps: ModalProps, onColorwayId: (colorwayID: string) => void; }) { - const [colorwayID, setColorwayID] = useState(""); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - return
-
- Colorway ID: - setColorwayID(value)} - /> -
-
- - -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/MainModal.tsx b/src/equicordplugins/discordColorways/components/MainModal.tsx deleted file mode 100644 index 189b61a8..00000000 --- a/src/equicordplugins/discordColorways/components/MainModal.tsx +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { MouseEvent, MouseEventHandler } from "react"; - -import { DataStore, useEffect, useRef, useState } from "../"; -import { ModalProps } from "../types"; -import { restartWS, updateRemoteSources, wsOpen } from "../wsClient"; -// eslint-disable-next-line no-duplicate-imports -import { boundKey as bk } from "../wsClient"; -import Selector from "./Selector"; -import SettingsPage from "./SettingsTabs/SettingsPage"; -import SourceManager from "./SettingsTabs/SourceManager"; -import Store from "./SettingsTabs/Store"; - -export let changeTheme = (theme: string) => { }; -export let updateWSMain: (status: boolean) => void = () => { }; -export let updateBoundKeyMain: (boundKey: { [managerKey: string]: string; }) => void = () => { }; - -export default function ({ - modalProps -}: { - modalProps: ModalProps; -}): JSX.Element | any { - const [activeTab, setActiveTab] = useState<"selector" | "settings" | "sources" | "store" | "ws_connection">("selector"); - const [theme, setTheme] = useState("discord"); - const [pos, setPos] = useState({ x: 0, y: 0 }); - const [showMenu, setShowMenu] = useState(false); - const [wsConnected, setWsConnected] = useState(wsOpen); - const [boundKey, setBoundKey] = useState<{ [managerKey: string]: string; }>(bk as { [managerKey: string]: string; }); - const menuProps = useRef(null); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - updateWSMain = status => setWsConnected(status); - changeTheme = (theme: string) => setTheme(theme); - updateBoundKeyMain = bound => setBoundKey(bound); - load(); - - return () => { - updateWSMain = () => { }; - changeTheme = () => { }; - updateBoundKeyMain = () => { }; - }; - }, []); - - function SidebarTab({ id, title, icon, bottom }: { id: "selector" | "settings" | "sources" | "store" | "ws_connection", title: string, icon: JSX.Element, bottom?: boolean; }) { - return
setActiveTab(id)) as unknown as MouseEventHandler) : rightClickContextMenu}>{icon}
; - } - - const rightClickContextMenu: MouseEventHandler = (e: MouseEvent) => { - e.stopPropagation(); - window.dispatchEvent(new Event("click")); - setShowMenu(!showMenu); - setPos({ - x: e.currentTarget.getBoundingClientRect().x + e.currentTarget.offsetWidth + 8, - y: e.currentTarget.getBoundingClientRect().y + e.currentTarget.offsetHeight - (menuProps.current as unknown as HTMLElement).offsetHeight - }); - }; - function onPageClick(this: Window, e: globalThis.MouseEvent) { - setShowMenu(false); - } - - useEffect(() => { - window.addEventListener("click", onPageClick); - return () => { - window.removeEventListener("click", onPageClick); - }; - }, []); - - return ( - <> -
-
- } id="selector" title="Change Colorway" /> - } id="settings" title="Settings" /> - } id="sources" title="Sources" /> - } id="store" title="Store" /> - } id="ws_connection" title="Manager Connection" /> -
-
- {activeTab === "selector" && } - {activeTab === "sources" && } - {activeTab === "store" && } - {activeTab === "settings" &&
} -
-
- Manager Connection Status: {wsConnected ? "Connected" : "Disconnected"} - {wsConnected ? <> - Bound Key: {JSON.stringify(boundKey)} - - - - : <>} -
-
- - ); -} diff --git a/src/equicordplugins/discordColorways/components/PCSMigrationModal.tsx b/src/equicordplugins/discordColorways/components/PCSMigrationModal.tsx deleted file mode 100644 index 47a01049..00000000 --- a/src/equicordplugins/discordColorways/components/PCSMigrationModal.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, useEffect, useState } from ".."; -import { ModalProps } from "../types"; - -export default function ({ modalProps }: { modalProps: ModalProps; }) { - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - return
-

- Project Colorway has moved -

-
- - In the process of creating a more solid foundation - for Project Colorway, the main Project Colorway repository has been - moved from https://github.com/DaBluLite/ProjectColorway to{" "} - https://github.com/ProjectColorway/ProjectColorway - -
- The default Project Colorway source has been automatically updated/re-added. -
-
-
; -} diff --git a/src/equicordplugins/discordColorways/components/ReloadButton.tsx b/src/equicordplugins/discordColorways/components/ReloadButton.tsx deleted file mode 100644 index 010fdcb5..00000000 --- a/src/equicordplugins/discordColorways/components/ReloadButton.tsx +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { MouseEvent } from "react"; - -import { useEffect, useRef, useState } from ".."; - -export default function ({ onClick, onForceReload }: { onClick: () => void, onForceReload: () => void; }) { - const menuProps = useRef(null); - const [pos, setPos] = useState({ x: 0, y: 0 }); - const [showMenu, setShowMenu] = useState(false); - - function rightClickContextMenu(e: MouseEvent) { - e.stopPropagation(); - window.dispatchEvent(new Event("click")); - setShowMenu(!showMenu); - setPos({ - x: e.currentTarget.getBoundingClientRect().x, - y: e.currentTarget.getBoundingClientRect().y + e.currentTarget.offsetHeight + 8 - }); - } - function onPageClick(this: Window, e: globalThis.MouseEvent) { - setShowMenu(false); - } - - useEffect(() => { - window.addEventListener("click", onPageClick); - return () => { - window.removeEventListener("click", onPageClick); - }; - }, []); - - function onForceReload_internal() { - onForceReload(); - setShowMenu(false); - } - - return <> - {showMenu ? : null} - - ; -} diff --git a/src/equicordplugins/discordColorways/components/SaveColorwayModal.tsx b/src/equicordplugins/discordColorways/components/SaveColorwayModal.tsx deleted file mode 100644 index 6f09d906..00000000 --- a/src/equicordplugins/discordColorways/components/SaveColorwayModal.tsx +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, openModal, useEffect, useState } from ".."; -import { Colorway, ModalProps } from "../types"; -import { PlusIcon } from "./Icons"; -import { StoreNameModal } from "./SettingsTabs/SourceManager"; - -export default function ({ modalProps, colorways, onFinish }: { modalProps: ModalProps, colorways: Colorway[], onFinish: () => void; }) { - const [offlineColorwayStores, setOfflineColorwayStores] = useState<{ name: string, colorways: Colorway[], id?: string; }[]>([]); - const [storename, setStorename] = useState(); - const [noStoreError, setNoStoreError] = useState(false); - useEffect(() => { - (async () => { - setOfflineColorwayStores(await DataStore.get("customColorways") as { name: string, colorways: Colorway[], id?: string; }[]); - })(); - }); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - return
-

- Save to source: -

-
- {noStoreError ? Error: No store selected : <>} - {offlineColorwayStores.map(store =>
{ - setStorename(store.name); - }}> - - {store.name} -
)} -
{ - openModal(props => { - await DataStore.set("customColorways", [...await DataStore.get("customColorways"), { name: e, colorways: [] }]); - setOfflineColorwayStores(await DataStore.get("customColorways") as { name: string, colorways: Colorway[]; }[]); - }} />); - }}> - - Create new store... -
-
-
- - - -
-
; - } - openModal(propss => { - const newStore = { name: storeToModify.name, colorways: [...storeToModify.colorways, { ...colorway, name: e }] }; - DataStore.set("customColorways", [...oldStores!.filter(source => source.name !== storename), newStore]); - props.onClose(); - if (i + 1 === colorways.length) { - modalProps.onClose(); - onFinish!(); - } - }} />); - }} - > - Rename - - -
-
); - } else { - const newStore = { name: storeToModify.name, colorways: [...storeToModify.colorways, colorway] }; - DataStore.set("customColorways", [...oldStores!.filter(source => source.name !== storename), newStore]); - if (i + 1 === colorways.length) { - modalProps.onClose(); - onFinish(); - } - } - }); - } - }} - > - Finish - - -
- ; -} diff --git a/src/equicordplugins/discordColorways/components/Selector.tsx b/src/equicordplugins/discordColorways/components/Selector.tsx deleted file mode 100644 index 7e0e0968..00000000 --- a/src/equicordplugins/discordColorways/components/Selector.tsx +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, ReactNode, Toasts } from ".."; -import { openModal, useEffect, useState } from "../"; -import { ColorwayCSS } from "../colorwaysAPI"; -import { nullColorwayObj } from "../constants"; -import { generateCss, getAutoPresets, gradientBase } from "../css"; -import { Colorway, ColorwayObject, ModalProps, SortOptions, SourceObject } from "../types"; -import { colorToHex, getHex, stringToHex } from "../utils"; -import { hasManagerRole, requestManagerRole, sendColorway, updateRemoteSources, wsOpen } from "../wsClient"; -import AutoColorwaySelector from "./AutoColorwaySelector"; -import CreatorModal from "./CreatorModal"; -import FiltersMenu from "./FiltersMenu"; -import { CodeIcon, DeleteIcon, IDIcon, PalleteIcon, PlusIcon } from "./Icons"; -import InfoModal from "./InfoModal"; -import ReloadButton from "./ReloadButton"; -import SourcesMenu from "./SourcesMenu"; -import UseRepainterThemeModal from "./UseRepainterThemeModal"; - -export let updateWS: (status: boolean) => void = () => { }; -export let updateManagerRole: (hasManager: boolean) => void = () => { }; -export let updateActiveColorway: (active: ColorwayObject) => void = () => { }; - -export default function ({ - settings = { selectorType: "normal" }, - hasTheme = false -}: { - settings?: { selectorType: "preview" | "multiple-selection" | "normal", previewSource?: string, onSelected?: (colorways: Colorway[]) => void; }; - hasTheme?: boolean; -}) { - const [colorwayData, setColorwayData] = useState([]); - const [searchValue, setSearchValue] = useState(""); - const [sortBy, setSortBy] = useState(SortOptions.NAME_AZ); - const [activeColorwayObject, setActiveColorwayObject] = useState(nullColorwayObj); - const [customColorwayData, setCustomColorwayData] = useState([]); - const [loaderHeight, setLoaderHeight] = useState<"2px" | "0px">("2px"); - const [visibleSources, setVisibleSources] = useState("all"); - const [selectedColorways, setSelectedColorways] = useState([]); - const [errorCode, setErrorCode] = useState(0); - const [wsConnected, setWsConnected] = useState(wsOpen); - const [theme, setTheme] = useState("discord"); - const [isManager, setManager] = useState(hasManagerRole); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - updateWS = status => { - setWsConnected(status); - }; - console.log(hasManagerRole); - updateManagerRole = hasManager => { - setManager(hasManager); - console.log(hasManager); - }; - updateActiveColorway = setActiveColorwayObject; - return () => { - updateWS = () => { }; - updateManagerRole = () => { }; - updateActiveColorway = () => { }; - }; - }, [isManager]); - - const filters = [ - { - name: "All", - id: "all", - sources: [...colorwayData, ...customColorwayData] - }, - ...colorwayData.map(source => ({ - name: source.source, - id: source.source.toLowerCase().replaceAll(" ", "-"), - sources: [source] - })), - ...customColorwayData.map(source => ({ - name: source.source, - id: source.source.toLowerCase().replaceAll(" ", "-"), - sources: [source] - })) - ]; - - async function loadUI(force?: boolean) { - setActiveColorwayObject(await DataStore.get("activeColorwayObject") as ColorwayObject); - setLoaderHeight("0px"); - - if (settings.previewSource) { - - const res: Response = await fetch(settings.previewSource); - - const dataPromise = res.json().then(data => data).catch(() => ({ colorways: [], errorCode: 1, errorMsg: "Colorway Source format is invalid" })); - - const data = await dataPromise; - - if (data.errorCode) { - setErrorCode(data.errorCode); - } - - const colorwayList: Colorway[] = data.css ? data.css.map(customStore => customStore.colorways).flat() : data.colorways; - - setColorwayData([{ colorways: colorwayList || [], source: res.url, type: "online" }] as { type: "online" | "offline" | "temporary", source: string, colorways: Colorway[]; }[]); - - } else { - setCustomColorwayData((await DataStore.get("customColorways") as { name: string, colorways: Colorway[], id?: string; }[]).map((colorSrc: { name: string, colorways: Colorway[], id?: string; }) => ({ type: "offline", source: colorSrc.name, colorways: colorSrc.colorways }))); - - const onlineSources: { name: string, url: string; }[] = await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]; - - const responses: Response[] = await Promise.all( - onlineSources.map(source => - fetch(source.url, force ? { cache: "no-store" } : {}) - ) - ); - - setColorwayData(await Promise.all( - responses - .map((res, i) => ({ response: res, name: onlineSources[i].name })) - .map((res: { response: Response, name: string; }) => - res.response.json().then(dt => ({ colorways: dt.colorways as Colorway[], source: res.name, type: "online" })).catch(() => ({ colorways: [] as Colorway[], source: res.name, type: "online" })) - )) as { type: "online" | "offline" | "temporary", source: string, colorways: Colorway[]; }[]); - } - } - - useEffect(() => { loadUI(); }, [searchValue]); - - function Header({ children }: { children: ReactNode; }) { - if (hasTheme) return
{children}
; - else return
{children}
; - } - - function Container({ children }: { children: ReactNode; }) { - if (hasTheme) return
{children}
; - else return
{children}
; - } - - return <>{(settings.selectorType !== "preview" && (!wsConnected || (wsConnected && isManager))) ?
- setSearchValue(value)} - /> -
- { - setLoaderHeight("2px"); - loadUI().then(() => setLoaderHeight("0px")); - }} onForceReload={() => { - setLoaderHeight("2px"); - loadUI(true).then(() => setLoaderHeight("0px")); - }} /> - - - { - setSortBy(newSort); - }} /> - filter.id === visibleSources)[0]} sources={filters} onSourceChange={sourceId => { - setVisibleSources(sourceId); - }} /> -
-
: <>} - {(wsConnected && settings.selectorType === "normal" && !isManager) ? - - - - Manager is controlling the colorways - - : <> -
- - {(activeColorwayObject.sourceType === "temporary" && settings.selectorType === "normal" && settings.selectorType === "normal") &&
{ - DataStore.set("activeColorwayObject", nullColorwayObj); - setActiveColorwayObject(nullColorwayObj); - ColorwayCSS.remove(); - }} - > -
-
-
-
-
-
- Temporary Colorway - -
} - {getComputedStyle(document.body).getPropertyValue("--os-accent-color") && ["all", "official"].includes(visibleSources) && settings.selectorType === "normal" && "auto".includes(searchValue.toLowerCase()) ?
{ - if (isManager) { - Toasts.show({ - message: "Cannot use Auto colorway while on manager mode", - type: 2, - id: "colorways-manager-role-auto-colorway-error" - }); - } else { - const activeAutoPreset = await DataStore.get("activeAutoPreset"); - if (activeColorwayObject.id === "Auto") { - DataStore.set("activeColorwayObject", nullColorwayObj); - setActiveColorwayObject(nullColorwayObj); - ColorwayCSS.remove(); - } else { - if (!activeAutoPreset) { - openModal((props: ModalProps) => { - const demandedColorway = getAutoPresets(colorToHex(getComputedStyle(document.body).getPropertyValue("--os-accent-color")).slice(0, 6))[autoPresetId].preset(); - ColorwayCSS.set(demandedColorway); - const newObj: ColorwayObject = { - id: "Auto", - css: demandedColorway, - sourceType: "online", - source: null, - colors: { - accent: colorToHex(getComputedStyle(document.body).getPropertyValue("--os-accent-color")).slice(0, 6) - } - }; - DataStore.set("activeColorwayObject", newObj); - setActiveColorwayObject(newObj); - }} />); - } else { - const autoColorway = getAutoPresets(colorToHex(getComputedStyle(document.body).getPropertyValue("--os-accent-color")).slice(0, 6))[activeAutoPreset].preset(); - const newObj: ColorwayObject = { - id: "Auto", - css: autoColorway, - sourceType: "online", - source: null, - colors: { - accent: colorToHex(getComputedStyle(document.body).getPropertyValue("--os-accent-color")).slice(0, 6) - } - }; - DataStore.set("activeColorwayObject", newObj); - setActiveColorwayObject(newObj); - ColorwayCSS.set(autoColorway); - } - } - } - }} - > -
- Auto Colorway - -
: <>} - {(!getComputedStyle(document.body).getPropertyValue("--os-accent-color") || !["all", "official"].includes(visibleSources)) && !filters.filter(filter => filter.id === visibleSources)[0].sources.map(source => source.colorways).flat().length ? - No colorways... - : <>} - {errorCode !== 0 && - {errorCode === 1 && "Error: Invalid Colorway Source Format. If this error persists, contact the source author to resolve the issue."} - } - {filters.map(filter => filter.id).includes(visibleSources) && ( - filters - .filter(filter => filter.id === visibleSources)[0].sources - .map(({ colorways, source, type }) => colorways.map((colorway: Colorway) => ({ ...colorway, sourceType: type, source: source, preset: colorway.preset || (colorway.isGradient ? "Gradient" : "Default") }))) - .flat() - .sort((a, b) => { - switch (sortBy) { - case SortOptions.NAME_AZ: - return a.name.localeCompare(b.name); - case SortOptions.NAME_ZA: - return b.name.localeCompare(a.name); - case SortOptions.SOURCE_AZ: - return a.source.localeCompare(b.source); - case SortOptions.SOURCE_ZA: - return b.source.localeCompare(a.source); - default: - return a.name.localeCompare(b.name); - } - }) - .map((color: Colorway) => color.colors ? color : { ...color, colors: ["accent", "primary", "secondary", "tertiary"] }) - .map((color: Colorway) => { - const colors: { accent?: string, primary?: string, secondary?: string, tertiary?: string; } = {}; - color.colors!.map(colorStr => colors[colorStr] = colorToHex(color[colorStr])); - return { ...color, colorObj: colors }; - }) - .map((color: Colorway) => { - return (color.name.toLowerCase().includes(searchValue.toLowerCase()) ? -
{ - if (settings.selectorType === "normal") { - const [ - onDemandWays, - onDemandWaysTintedText, - onDemandWaysDiscordSaturation, - onDemandWaysOsAccentColor - ] = await DataStore.getMany([ - "onDemandWays", - "onDemandWaysTintedText", - "onDemandWaysDiscordSaturation", - "onDemandWaysOsAccentColor" - ]); - if (activeColorwayObject.id === color.name && activeColorwayObject.source === color.source) { - if (isManager) { - sendColorway(nullColorwayObj); - } else { - DataStore.set("activeColorwayObject", nullColorwayObj); - setActiveColorwayObject(nullColorwayObj); - ColorwayCSS.remove(); - } - } else { - if (isManager) { - const newObj: ColorwayObject = { - id: color.name, - sourceType: color.type, - source: color.source, - colors: color.colorObj - }; - sendColorway(newObj); - } else { - if (onDemandWays) { - const demandedColorway = !color.isGradient ? generateCss( - colorToHex(color.primary), - colorToHex(color.secondary), - colorToHex(color.tertiary), - colorToHex(onDemandWaysOsAccentColor ? getComputedStyle(document.body).getPropertyValue("--os-accent-color") : color.accent).slice(0, 6), - onDemandWaysTintedText, - onDemandWaysDiscordSaturation, - undefined, - color.name - ) : gradientBase(colorToHex(onDemandWaysOsAccentColor ? getComputedStyle(document.body).getPropertyValue("--os-accent-color") : color.accent), onDemandWaysDiscordSaturation) + `:root:root {--custom-theme-background: linear-gradient(${color.linearGradient})}`; - ColorwayCSS.set(demandedColorway); - const newObj: ColorwayObject = { - id: color.name, - css: demandedColorway, - sourceType: color.type, - source: color.source, - colors: { ...color.colorObj, accent: colorToHex(onDemandWaysOsAccentColor ? getComputedStyle(document.body).getPropertyValue("--os-accent-color") : color.accent).slice(0, 6) } - }; - setActiveColorwayObject(newObj); - DataStore.set("activeColorwayObject", newObj); - } else { - ColorwayCSS.set(color["dc-import"]); - const newObj: ColorwayObject = { - id: color.name, - css: color["dc-import"], - sourceType: color.type, - source: color.source, - colors: color.colorObj - }; - setActiveColorwayObject(newObj); - DataStore.set("activeColorwayObject", newObj); - } - } - } - } - if (settings.selectorType === "multiple-selection") { - if (selectedColorways.includes(color)) { - setSelectedColorways(selectedColorways.filter(c => c !== color)); - } else { - setSelectedColorways([...selectedColorways, color]); - } - } - }} - > -
- {!color.isGradient ? Object.values(color.colorObj as { accent?: string, primary?: string, secondary?: string, tertiary?: string; }).map(colorStr =>
) :
} -
- {color.name} - {settings.selectorType === "normal" && } - - - {(color.sourceType === "offline" && settings.selectorType !== "preview") && } -
: <> - ); - }) - )} - - }; -} diff --git a/src/equicordplugins/discordColorways/components/Setting.tsx b/src/equicordplugins/discordColorways/components/Setting.tsx deleted file mode 100644 index 2a3d5b9d..00000000 --- a/src/equicordplugins/discordColorways/components/Setting.tsx +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { ReactNode } from "../"; - -export default function ({ - children, - divider = false, - disabled = false -}: { children: ReactNode, divider?: boolean, disabled?: boolean; }) { - return
- {disabled ?
{children}
: children} - {divider &&
} -
; -} diff --git a/src/equicordplugins/discordColorways/components/SettingsTabs/OnDemandPage.tsx b/src/equicordplugins/discordColorways/components/SettingsTabs/OnDemandPage.tsx deleted file mode 100644 index 2fe757ba..00000000 --- a/src/equicordplugins/discordColorways/components/SettingsTabs/OnDemandPage.tsx +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, ReactNode, useCallback, useEffect, useState } from "../../"; -import Setting from "../Setting"; -import Switch from "../Switch"; - -export default function ({ - hasTheme = false -}: { - hasTheme: boolean; -}) { - const [onDemand, setOnDemand] = useState(false); - const [onDemandTinted, setOnDemandTinted] = useState(false); - const [onDemandDiscordSat, setOnDemandDiscordSat] = useState(false); - const [onDemandOsAccent, setOnDemandOsAccent] = useState(false); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - async function loadUI() { - const [ - onDemandWays, - onDemandWaysTintedText, - onDemandWaysDiscordSaturation, - onDemandWaysOsAccentColor - ] = await DataStore.getMany([ - "onDemandWays", - "onDemandWaysTintedText", - "onDemandWaysDiscordSaturation", - "onDemandWaysOsAccentColor" - ]); - setOnDemand(onDemandWays); - setOnDemandTinted(onDemandWaysTintedText); - setOnDemandDiscordSat(onDemandWaysDiscordSaturation); - if (getComputedStyle(document.body).getPropertyValue("--os-accent-color") !== "") { - setOnDemandOsAccent(onDemandWaysOsAccentColor); - } - } - - const cached_loadUI = useCallback(loadUI, []); - - useEffect(() => { - cached_loadUI(); - }, []); - - function Container({ children }: { children: ReactNode; }) { - if (hasTheme) return
{children}
; - else return
{children}
; - } - - return - - { - setOnDemand(v); - DataStore.set("onDemandWays", v); - }} /> - Always utilise the latest of what DiscordColorways has to offer. CSS is being directly generated on the device and gets applied in the place of the normal import/CSS given by the colorway. - - - { - setOnDemandTinted(v); - DataStore.set("onDemandWaysTintedText", v); - }} /> - - - { - setOnDemandDiscordSat(v); - DataStore.set("onDemandWaysDiscordSaturation", v); - }} /> - - - { - setOnDemandOsAccent(v); - DataStore.set("onDemandWaysOsAccentColor", v); - }} /> - - ; -} diff --git a/src/equicordplugins/discordColorways/components/SettingsTabs/SettingsPage.tsx b/src/equicordplugins/discordColorways/components/SettingsTabs/SettingsPage.tsx deleted file mode 100644 index 1a5984e0..00000000 --- a/src/equicordplugins/discordColorways/components/SettingsTabs/SettingsPage.tsx +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, FluxDispatcher, FluxEvents, PluginProps, ReactNode, useEffect, useState } from "../../"; -import { defaultColorwaySource, fallbackColorways, nullColorwayObj } from "../../constants"; -import { Colorway } from "../../types"; -import { connect, updateShouldAutoconnect } from "../../wsClient"; -import { changeThemeIDCard } from "../ColorwayID"; -import { changeTheme as changeThemeMain } from "../MainModal"; -import Setting from "../Setting"; -import Switch from "../Switch"; - -function changeTheme(theme: string) { - changeThemeMain(theme); - changeThemeIDCard(theme); -} - -export default function ({ - hasTheme = false -}: { - hasTheme?: boolean; -}) { - const [colorways, setColorways] = useState([]); - const [customColorways, setCustomColorways] = useState([]); - const [colorsButtonVisibility, setColorsButtonVisibility] = useState(false); - const [theme, setTheme] = useState("discord"); - const [shouldAutoconnect, setShouldAutoconnect] = useState<"1" | "2">("1"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - setShouldAutoconnect(await DataStore.get("colorwaysManagerDoAutoconnect") as "1" | "2"); - } - load(); - }, []); - - useEffect(() => { - (async function () { - const [ - customColorways, - colorwaySourceFiles, - showColorwaysButton - ] = await DataStore.getMany([ - "customColorways", - "colorwaySourceFiles", - "showColorwaysButton" - ]); - const responses: Response[] = await Promise.all( - colorwaySourceFiles.map(({ url }: { url: string; }) => - fetch(url) - ) - ); - const data = await Promise.all( - responses.map((res: Response) => - res.json().catch(() => { return { colorways: [] }; }) - )); - const colorways = data.flatMap(json => json.colorways); - setColorways(colorways || fallbackColorways); - setCustomColorways(customColorways.map(source => source.colorways).flat(2)); - setColorsButtonVisibility(showColorwaysButton); - })(); - }, []); - - function Container({ children }: { children: ReactNode; }) { - if (hasTheme) return
{children}
; - else return
{children}
; - } - - return - Quick Switch - - { - setColorsButtonVisibility(v); - DataStore.set("showColorwaysButton", v); - FluxDispatcher.dispatch({ - type: "COLORWAYS_UPDATE_BUTTON_VISIBILITY" as FluxEvents, - isVisible: v - }); - }} /> - Shows a button on the top of the servers list that opens a colorway selector modal. - - Appearance - -
- - -
-
- Manager - -
- - -
-
- -
- - -
-
- -
- - -
- Reset the plugin to its default settings. All bound managers, sources, and colorways will be deleted. Please reload Discord after use. -
-
-

- Discord Colorways -

- by Project Colorway - - Plugin Version: - - - {PluginProps.pluginVersion} ({PluginProps.clientMod}) - - - UI Version: - - - {PluginProps.UIVersion} - - - Creator Version: - - - {PluginProps.creatorVersion} - - - Loaded Colorways: - - - {[...colorways, ...customColorways].length} - - - Project Repositories: - - DiscordColorways - Project Colorway -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/SettingsTabs/SourceManager.tsx b/src/equicordplugins/discordColorways/components/SettingsTabs/SourceManager.tsx deleted file mode 100644 index 7d7e2a9c..00000000 --- a/src/equicordplugins/discordColorways/components/SettingsTabs/SourceManager.tsx +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, openModal, ReactNode, useEffect, useState } from "../../"; -import { defaultColorwaySource } from "../../constants"; -import { Colorway, ModalProps } from "../../types"; -import { chooseFile, saveFile } from "../../utils"; -import { updateRemoteSources } from "../../wsClient"; -import { CopyIcon, DeleteIcon, DownloadIcon, ImportIcon, PlusIcon } from "../Icons"; -import TabBar from "../TabBar"; - -export function StoreNameModal({ modalProps, originalName, onFinish, conflicting }: { modalProps: ModalProps, originalName: string, onFinish: (newName: string) => Promise, conflicting: boolean; }) { - const [error, setError] = useState(""); - const [newStoreName, setNewStoreName] = useState(originalName); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - return
-

- {conflicting ? "Duplicate Store Name" : "Give this store a name"} -

-
- {conflicting ? A store with the same name already exists. Please give a different name to the imported store: : <>} - Name: - setNewStoreName(value)} style={{ marginBottom: "16px" }} /> -
-
- - -
-
; -} - -function AddOnlineStoreModal({ modalProps, onFinish }: { modalProps: ModalProps, onFinish: (name: string, url: string) => void; }) { - const [colorwaySourceName, setColorwaySourceName] = useState(""); - const [colorwaySourceURL, setColorwaySourceURL] = useState(""); - const [nameError, setNameError] = useState(""); - const [URLError, setURLError] = useState(""); - const [nameReadOnly, setNameReadOnly] = useState(false); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - return
-

- Add a source: -

-
- Name: - setColorwaySourceName(e.currentTarget.value)} - value={colorwaySourceName} - readOnly={nameReadOnly} - disabled={nameReadOnly} - /> - URL: - { - setColorwaySourceURL(value); - if (value === defaultColorwaySource) { - setNameReadOnly(true); - setColorwaySourceName("Project Colorway"); - } - }} - value={colorwaySourceURL} - style={{ marginBottom: "16px" }} - /> -
-
- - -
-
; -} - -export default function ({ - hasTheme = false -}: { - hasTheme?: boolean; -}) { - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - function Container({ children }: { children: ReactNode; }) { - if (hasTheme) return
{children}
; - else return
{children}
; - } - - return - - ; -} - -function OfflineTab() { - const [customColorwayStores, setCustomColorwayStores] = useState<{ name: string, colorways: Colorway[]; }[]>([]); - useEffect(() => { - (async function () { - setCustomColorwayStores(await DataStore.get("customColorways") as { name: string, colorways: Colorway[]; }[]); - updateRemoteSources(); - })(); - }, []); - return
-
- - -
-
- {getComputedStyle(document.body).getPropertyValue("--os-accent-color") ?
-
- OS Accent Color{" "} -
Built-In
-
-
-
: <>} - {customColorwayStores.map(({ name: customColorwaySourceName, colorways: offlineStoreColorways }) =>
- - {customColorwaySourceName} - -
- - -
-
- )} -
-
; -} - -function OnlineTab() { - const [colorwaySourceFiles, setColorwaySourceFiles] = useState<{ name: string, url: string; }[]>([]); - useEffect(() => { - (async function () { - setColorwaySourceFiles(await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]); - updateRemoteSources(); - })(); - }, []); - return
-
- -
-
- {!colorwaySourceFiles.length &&
{ - DataStore.set("colorwaySourceFiles", [{ name: "Project Colorway", url: defaultColorwaySource }, ...(await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]).filter(i => i.name !== "Project Colorway")]); - setColorwaySourceFiles([{ name: "Project Colorway", url: defaultColorwaySource }, ...(await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]).filter(i => i.name !== "Project Colorway")]); - }}> - - - Add Project Colorway Source - -
} - {colorwaySourceFiles.map((colorwaySourceFile: { name: string, url: string; }, i: number) =>
-
- - {colorwaySourceFile.name} {colorwaySourceFile.url === defaultColorwaySource &&
Built-In
} {colorwaySourceFile.url === "https://raw.githubusercontent.com/DaBluLite/ProjectColorway/master/index.json" &&
Built-In | Outdated
} -
- - {colorwaySourceFile.url} - -
-
- - {colorwaySourceFile.url === "https://raw.githubusercontent.com/DaBluLite/ProjectColorway/master/index.json" && } - {(colorwaySourceFile.url !== defaultColorwaySource && colorwaySourceFile.url !== "https://raw.githubusercontent.com/DaBluLite/ProjectColorway/master/index.json") - && <> - - - } -
-
- )} -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/SettingsTabs/Store.tsx b/src/equicordplugins/discordColorways/components/SettingsTabs/Store.tsx deleted file mode 100644 index 49a2cb36..00000000 --- a/src/equicordplugins/discordColorways/components/SettingsTabs/Store.tsx +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, openModal, ReactNode, useEffect, useState } from "../../"; -import { StoreItem } from "../../types"; -import { DeleteIcon, DownloadIcon, PalleteIcon } from "../Icons"; -import Selector from "../Selector"; - -export default function ({ - hasTheme = false -}: { - hasTheme?: boolean; -}) { - const [storeObject, setStoreObject] = useState([]); - const [colorwaySourceFiles, setColorwaySourceFiles] = useState<{ name: string, url: string; }[]>([]); - const [searchValue, setSearchValue] = useState(""); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - useEffect(() => { - if (!searchValue) { - (async function () { - const res: Response = await fetch("https://dablulite.vercel.app/"); - const data = await res.json(); - setStoreObject(data.sources); - setColorwaySourceFiles(await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]); - })(); - } - }, []); - - function Container({ children }: { children: ReactNode; }) { - if (hasTheme) return
{children}
; - else return
{children}
; - } - - return -
- setSearchValue(e.currentTarget.value)} - /> - -
-
- {storeObject.map((item: StoreItem) => - item.name.toLowerCase().includes(searchValue.toLowerCase()) ?
-
- - {item.name} - - - {item.description} - - - by {item.authorGh} - -
-
- - GitHub - - - -
-
: <> - )} -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/SourcesMenu.tsx b/src/equicordplugins/discordColorways/components/SourcesMenu.tsx deleted file mode 100644 index 3b6e6406..00000000 --- a/src/equicordplugins/discordColorways/components/SourcesMenu.tsx +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { MouseEvent } from "react"; - -import { useEffect, useRef, useState } from ".."; - -export default function ({ source, sources, onSourceChange }: { source: { name: string, id: string; }, sources: { name: string, id: string; }[], onSourceChange: (sourceId: string) => void; }) { - const menuProps = useRef(null); - const [pos, setPos] = useState({ x: 0, y: 0 }); - const [showMenu, setShowMenu] = useState(false); - const [current, setCurrent] = useState(source); - - function rightClickContextMenu(e: MouseEvent) { - e.stopPropagation(); - window.dispatchEvent(new Event("click")); - setShowMenu(!showMenu); - setPos({ - x: e.currentTarget.getBoundingClientRect().x, - y: e.currentTarget.getBoundingClientRect().y + e.currentTarget.offsetHeight + 8 - }); - } - function onPageClick() { - setShowMenu(false); - } - - useEffect(() => { - window.addEventListener("click", onPageClick); - return () => { - window.removeEventListener("click", onPageClick); - }; - }, []); - - function onSourceChange_internal(newSort: { name: string, id: string; }) { - onSourceChange(newSort.id); - setCurrent(newSort); - setShowMenu(false); - } - - return <> - {showMenu ? : null} - - ; -} diff --git a/src/equicordplugins/discordColorways/components/Spinner.tsx b/src/equicordplugins/discordColorways/components/Spinner.tsx deleted file mode 100644 index 882f50fc..00000000 --- a/src/equicordplugins/discordColorways/components/Spinner.tsx +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -export default function ({ className, style }: { className?: string, style?: any; }) { - return
-
- - - - - -
-
; -} diff --git a/src/equicordplugins/discordColorways/components/Switch.tsx b/src/equicordplugins/discordColorways/components/Switch.tsx deleted file mode 100644 index 8533a278..00000000 --- a/src/equicordplugins/discordColorways/components/Switch.tsx +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -export default function ({ - onChange, - value, - id, - label -}: { - id?: string, - value: boolean, - label?: string, - onChange: (checked: boolean) => void; -}) { - return label ?
- -
- - { - onChange(e.currentTarget.checked); - }} /> -
-
:
- - { - onChange(e.currentTarget.checked); - }} /> -
; -} diff --git a/src/equicordplugins/discordColorways/components/TabBar.tsx b/src/equicordplugins/discordColorways/components/TabBar.tsx deleted file mode 100644 index 5e960819..00000000 --- a/src/equicordplugins/discordColorways/components/TabBar.tsx +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { useState } from ".."; - -export default function ({ - items = [] -}: { - items: { name: string, component: () => JSX.Element; }[]; -}) { - const [active, setActive] = useState(items[0].name); - return <> -
- {items.map(item => { - return
{ - setActive(item.name); - }}>{item.name}
; - })} -
- {items.map(item => { - const Component = item.component; - return active === item.name ? : null; - })} - ; -} diff --git a/src/equicordplugins/discordColorways/components/ThemePreview.tsx b/src/equicordplugins/discordColorways/components/ThemePreview.tsx deleted file mode 100644 index c892d088..00000000 --- a/src/equicordplugins/discordColorways/components/ThemePreview.tsx +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { openModal } from ".."; -import { ModalProps } from "../types"; -import { HexToHSL } from "../utils"; -import { CloseIcon } from "./Icons"; - -export default function ThemePreview({ - accent, - primary, - secondary, - tertiary, - previewCSS, - modalProps, - isModal -}: { - accent: string, - primary: string, - secondary: string, - tertiary: string, - previewCSS?: string, - modalProps?: ModalProps, - isModal?: boolean; -}) { - return <> - -
-
-
-
-
-
e.currentTarget.style.background = accent} - onMouseLeave={e => e.currentTarget.style.background = `var(--dc-guild-button, ${primary})`} - onClick={() => { - if (isModal) { - modalProps?.onClose(); - } else { - openModal((props: ModalProps) =>
- - -
); - } - }} - > - {isModal ? : } -
-
-
-
-
-
-
e.currentTarget.style.background = accent} - onMouseLeave={e => e.currentTarget.style.background = `var(--dc-guild-button, ${primary})`} - /> -
-
-
e.currentTarget.style.background = accent} - onMouseLeave={e => e.currentTarget.style.background = `var(--dc-guild-button, ${primary})`} - /> -
-
-
-
-
-
-
-
-
-
- - Preview - -
-
-
-
-
-
-
-
-
- ; -} diff --git a/src/equicordplugins/discordColorways/components/Tooltip.tsx b/src/equicordplugins/discordColorways/components/Tooltip.tsx deleted file mode 100644 index 28491593..00000000 --- a/src/equicordplugins/discordColorways/components/Tooltip.tsx +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { useEffect, useRef, useState } from ".."; - -export default function ({ - children, - text, - position = "top" -}: { - children: (props: { onMouseEnter: () => void; onMouseLeave: () => void; onClick: () => void; }) => JSX.Element, - text: JSX.Element, - position?: "top" | "bottom" | "left" | "right"; -}) { - const [visible, setVisible] = useState(false); - const [pos, setPos] = useState({ x: 0, y: 0 }); - const btn = useRef(null); - - function showTooltip() { - setPos({ - x: (btn.current as unknown as HTMLElement).children[0].getBoundingClientRect().x + ((btn.current as unknown as HTMLElement).children[0] as HTMLElement).offsetWidth + 8, - y: (btn.current as unknown as HTMLElement).children[0].getBoundingClientRect().y - }); - setVisible(true); - } - - function onWindowUnfocused(e) { - e = e || window.event; - var from = e.relatedTarget || e.toElement; - if (!from || from.nodeName === "HTML") { - setVisible(false); - } - } - - useEffect(() => { - document.addEventListener("mouseout", onWindowUnfocused); - return () => { - document.removeEventListener("mouseout", onWindowUnfocused); - }; - }, []); - - return <> -
- {children({ - onMouseEnter: () => showTooltip(), - onMouseLeave: () => setVisible(false), - onClick: () => setVisible(false) - })} -
-
-
-
{text}
-
- ; -} diff --git a/src/equicordplugins/discordColorways/components/UseRepainterThemeModal.tsx b/src/equicordplugins/discordColorways/components/UseRepainterThemeModal.tsx deleted file mode 100644 index f9a01d02..00000000 --- a/src/equicordplugins/discordColorways/components/UseRepainterThemeModal.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore, useEffect, useState } from ".."; -import { ModalProps } from "../types"; -import { getRepainterTheme } from "../utils"; - -export default function ({ modalProps, onFinish }: { modalProps: ModalProps, onFinish: ({ id, colors }: { id: string, colors: string[]; }) => void; }) { - const [colorwaySourceURL, setColorwaySourceURL] = useState(""); - const [URLError, setURLError] = useState(""); - const [theme, setTheme] = useState("discord"); - - useEffect(() => { - async function load() { - setTheme(await DataStore.get("colorwaysPluginTheme") as string); - } - load(); - }, []); - - return
-

Use Repainter theme

-
- URL: {URLError ? {URLError} : <>} - { - setColorwaySourceURL(e.currentTarget.value); - }} - value={colorwaySourceURL} - className="colorwaySelector-search" - /> -
-
- - -
-
; -} diff --git a/src/equicordplugins/discordColorways/constants.ts b/src/equicordplugins/discordColorways/constants.ts deleted file mode 100644 index 516a267c..00000000 --- a/src/equicordplugins/discordColorways/constants.ts +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { ColorwayObject } from "./types"; - -export const defaultColorwaySource = "https://raw.githubusercontent.com/ProjectColorway/ProjectColorway/master/index.json"; - -export const fallbackColorways = [ - { - name: "Keyboard Purple", - original: false, - accent: "hsl(235 85.6% 64.7%)", - primary: "#222456", - secondary: "#1c1f48", - tertiary: "#080d1d", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/KeyboardPurple/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Eclipse", - original: false, - accent: "hsl(87 85.6% 64.7%)", - primary: "#000000", - secondary: "#181818", - tertiary: "#0a0a0a", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Eclipse/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Cyan", - original: false, - accent: "#009f88", - primary: "#202226", - secondary: "#1c1e21", - tertiary: "#141517", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Cyan/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Spotify", - original: false, - accent: "hsl(141 76% 48%)", - primary: "#121212", - secondary: "#090909", - tertiary: "#090909", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Spotify/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Bright n' Blue", - original: true, - accent: "hsl(234, 68%, 33%)", - primary: "#394aae", - secondary: "#29379d", - tertiary: "#1b278d", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/BrightBlue/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Still Young", - original: true, - accent: "hsl(58 85.6% 89%)", - primary: "#443a31", - secondary: "#7c3d3e", - tertiary: "#207578", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/StillYoung/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Sea", - original: true, - accent: "hsl(184, 100%, 50%)", - primary: "#07353b", - secondary: "#0b5e60", - tertiary: "#08201d", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Sea/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Lava", - original: true, - accent: "hsl(4, 80.4%, 32%)", - primary: "#401b17", - secondary: "#351917", - tertiary: "#230b0b", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Lava/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Solid Pink", - original: true, - accent: "hsl(340, 55.2%, 56.3%)", - primary: "#1e151c", - secondary: "#21181f", - tertiary: "#291e27", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/SolidPink/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Sand", - original: true, - accent: "hsl(41, 31%, 45%)", - primary: "#7f6c43", - secondary: "#665b33", - tertiary: "#5c5733", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Sand/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "AMOLED", - original: true, - accent: "hsl(235 85.6% 64.7%)", - primary: "#000000", - secondary: "#000000", - tertiary: "#000000", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Amoled/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Zorin", - original: false, - accent: "hsl(200, 89%, 86%)", - primary: "#171d20", - secondary: "#171d20", - tertiary: "#1e2529", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Zorin/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Desaturated", - original: false, - accent: "hsl(227, 58%, 65%)", - primary: "#35383d", - secondary: "#2c2f34", - tertiary: "#1e1f24", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Desaturated/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Crimson", - original: false, - accent: "hsl(0, 100%, 50%)", - primary: "#050000", - secondary: "#0a0000", - tertiary: "#0f0000", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Crimson/import.css);", - author: "Riddim_GLiTCH", - authorID: "801089753038061669", - }, - { - name: "Jupiter", - original: true, - accent: "#ffd89b", - primary: "#ffd89b", - secondary: "#19547b", - tertiary: "#1e1f22", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Jupiter/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - isGradient: true, - colors: ["accent", "primary", "secondary"], - }, - { - name: "Neon Candy", - original: true, - accent: "#FC00FF", - primary: "#00DBDE", - secondary: "#00DBDE", - tertiary: "#00DBDE", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/NeonCandy/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - isGradient: true, - colors: ["accent", "primary"], - }, - { - name: "Wildberry", - original: false, - accent: "#f40172", - primary: "#180029", - secondary: "#340057", - tertiary: "#4b007a", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Wildberry/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Facebook", - original: false, - accent: "#2375e1", - primary: "#18191a", - secondary: "#242526", - tertiary: "#3a3b3c", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Facebook/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Material You", - original: false, - accent: "#004977", - primary: "#1f1f1f", - secondary: "#28292a", - tertiary: "#2d2f31", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/MaterialYou/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "Discord Teal", - original: false, - accent: "#175f6d", - primary: "#313338", - secondary: "#2b2d31", - tertiary: "#1e1f22", - "dc-import": "@import url(//dablulite.github.io/css-snippets/DiscordTeal/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - colors: ["accent"], - }, - { - name: "黄昏の花 (Twilight Blossom)", - original: true, - accent: "#e100ff", - primary: "#04000a", - secondary: "#0b0024", - tertiary: "#210042", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/TwilightBlossom/import.css);", - author: "Riddim_GLiTCH", - authorID: "801089753038061669", - }, - { - name: "Chai", - original: true, - accent: "#59cd51", - primary: "#1c1e15", - secondary: "#1e2118", - tertiary: "#24291e", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/Chai/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, - { - name: "CS1.6", - original: false, - accent: "#929a8d", - primary: "#3f4738", - secondary: "#5b6c51", - tertiary: "#4d5945", - "dc-import": "@import url(//dablulite.github.io/DiscordColorways/CS16/import.css);", - author: "DaBluLite", - authorID: "582170007505731594", - }, -]; - - -export const knownThemeVars = { - "Cyan": { - variable: "--cyan-accent-color", - accent: "--cyan-accent-color", - primary: "--cyan-background-primary", - secondary: "--cyan-background-secondary" - }, - "Virtual Boy": { - variable: "--VBaccent", - tertiary: "--VBaccent-muted", - alt: { - tertiary: "--VBaccent-dimmest" - } - }, - "Modular": { - variable: "--modular-hue", - accentVariables: { - h: "--modular-hue", - s: "--modular-saturation", - l: "--modular-lightness" - } - }, - "Solana": { - variable: "--accent-hue", - accentVariables: { - h: "--accent-hue", - s: "--accent-saturation", - l: "--accent-brightness" - }, - primaryVariables: { - h: "--background-accent-hue", - s: "--background-accent-saturation", - l: "--background-accent-brightness" - } - } -}; - -export const mainColors = [ - { name: "accent", title: "Accent", var: "--brand-experiment" }, - { name: "primary", title: "Primary", var: "--background-primary" }, - { name: "secondary", title: "Secondary", var: "--background-secondary" }, - { name: "tertiary", title: "Tertiary", var: "--background-tertiary" } -]; - -export const nullColorwayObj: ColorwayObject = { id: null, css: null, sourceType: null, source: null }; diff --git a/src/equicordplugins/discordColorways/css.ts b/src/equicordplugins/discordColorways/css.ts deleted file mode 100644 index 1eb19046..00000000 --- a/src/equicordplugins/discordColorways/css.ts +++ /dev/null @@ -1,1027 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { PluginProps, UserStore } from "./"; -import { HexToHSL } from "./utils"; - -export const colorVariables: string[] = [ - "brand-100", - "brand-130", - "brand-160", - "brand-200", - "brand-230", - "brand-260", - "brand-300", - "brand-330", - "brand-345", - "brand-360", - "brand-400", - "brand-430", - "brand-460", - "brand-500", - "brand-530", - "brand-560", - "brand-600", - "brand-630", - "brand-660", - "brand-700", - "brand-730", - "brand-760", - "brand-800", - "brand-830", - "brand-860", - "brand-900", - "primary-900", - "primary-860", - "primary-830", - "primary-800", - "primary-760", - "primary-730", - "primary-700", - "primary-660", - "primary-645", - "primary-630", - "primary-600", - "primary-560", - "primary-530", - "primary-500", - "primary-460", - "primary-430", - "primary-400", - "primary-360", - "primary-330", - "primary-300", - "primary-260", - "primary-230", - "primary-200", - "primary-160", - "primary-130", - "primary-100", - "white-900", - "white-860", - "white-830", - "white-800", - "white-760", - "white-730", - "white-700", - "white-660", - "white-630", - "white-600", - "white-560", - "white-530", - "white-500", - "white-460", - "white-430", - "white-400", - "white-360", - "white-330", - "white-300", - "white-260", - "white-230", - "white-200", - "white-160", - "white-130", - "white-100", - "teal-900", - "teal-860", - "teal-830", - "teal-800", - "teal-760", - "teal-730", - "teal-700", - "teal-660", - "teal-630", - "teal-600", - "teal-560", - "teal-530", - "teal-500", - "teal-460", - "teal-430", - "teal-400", - "teal-360", - "teal-330", - "teal-300", - "teal-260", - "teal-230", - "teal-200", - "teal-160", - "teal-130", - "teal-100", - "black-900", - "black-860", - "black-830", - "black-800", - "black-760", - "black-730", - "black-700", - "black-660", - "black-630", - "black-600", - "black-560", - "black-530", - "black-500", - "black-460", - "black-430", - "black-400", - "black-360", - "black-330", - "black-300", - "black-260", - "black-230", - "black-200", - "black-160", - "black-130", - "black-100", - "red-900", - "red-860", - "red-830", - "red-800", - "red-760", - "red-730", - "red-700", - "red-660", - "red-630", - "red-600", - "red-560", - "red-530", - "red-500", - "red-460", - "red-430", - "red-400", - "red-360", - "red-330", - "red-300", - "red-260", - "red-230", - "red-200", - "red-160", - "red-130", - "red-100", - "yellow-900", - "yellow-860", - "yellow-830", - "yellow-800", - "yellow-760", - "yellow-730", - "yellow-700", - "yellow-660", - "yellow-630", - "yellow-600", - "yellow-560", - "yellow-530", - "yellow-500", - "yellow-460", - "yellow-430", - "yellow-400", - "yellow-360", - "yellow-330", - "yellow-300", - "yellow-260", - "yellow-230", - "yellow-200", - "yellow-160", - "yellow-130", - "yellow-100", - "green-900", - "green-860", - "green-830", - "green-800", - "green-760", - "green-730", - "green-700", - "green-660", - "green-630", - "green-600", - "green-560", - "green-530", - "green-500", - "green-460", - "green-430", - "green-400", - "green-360", - "green-330", - "green-300", - "green-260", - "green-230", - "green-200", - "green-160", - "green-130", - "green-100", -]; - -export const PrimarySatDiffs = { - 130: 63.9594, - 160: 49.4382, - 200: 37.5758, - 230: 30.3797, - 260: 22.5166, - 300: 32.5, - 330: 27.0968, - 345: 22.5166, - 360: 18.9189, - 400: -14.4, - 430: -33.0435, - 460: 25.2101, - 500: -11.0236, - 530: -3.0303, - 645: 7.40741, - 660: 3.0303, - 730: 11.9403, - 800: 25, -}; - -export const BrandSatDiffs = { - 100: -9.54712, - 130: 2.19526, - 160: -1.17509, - 200: -2.72351, - 230: 1.62225, - 260: 0.698487, - 300: 0.582411, - 330: -0.585823, - 345: -0.468384, - 360: 0.582411, - 400: 0.582411, - 430: 0.116754, - 460: -0.116891, - 530: -24.8194, - 560: -49.927, - 600: -58.8057, - 630: -58.8057, - 660: -58.0256, - 700: -58.2202, - 730: -58.6103, - 760: -58.4151, - 800: -57.2502, - 830: -57.4436, - 860: -58.4151, - 900: -52.5074 -}; - -export const BrandLightDiffs = { - 100: 33.5, - 130: 32.2, - 160: 30.2, - 200: 28.2, - 230: 26.2999, - 260: 23.8999, - 300: 21.2, - 330: 16.8999, - 345: 14.0999, - 360: 12.7999, - 400: 7.0999, - 430: 5.0999, - 460: 2.7999, - 530: -5.9, - 560: -12.3, - 600: -20.6, - 630: -26.5, - 660: -31.4, - 700: -38.8, - 730: -40.4, - 760: -42.5, - 800: -45.3, - 830: -49.8, - 860: -55.1, - 900: -61.6 -}; - -export const pureGradientBase = ` -.theme-dark :is(.colorwaysPreview-modal, .colorwaysPreview-wrapper) { - --dc-overlay-color: 0 0 0; - --dc-overlay-color-inverse: 255 255 255; - --dc-overlay-opacity-1: 0.85; - --dc-overlay-opacity-2: 0.8; - --dc-overlay-opacity-3: 0.7; - --dc-overlay-opacity-4: 0.5; - --dc-overlay-opacity-5: 0.4; - --dc-overlay-opacity-6: 0.1; - --dc-overlay-opacity-hover: 0.5; - --dc-overlay-opacity-hover-inverse: 0.08; - --dc-overlay-opacity-active: 0.45; - --dc-overlay-opacity-active-inverse: 0.1; - --dc-overlay-opacity-selected: 0.4; - --dc-overlay-opacity-selected-inverse: 0.15; - --dc-overlay-opacity-chat: 0.8; - --dc-overlay-opacity-home: 0.85; - --dc-overlay-opacity-home-card: 0.8; - --dc-overlay-opacity-app-frame: var(--dc-overlay-opacity-4); - --dc-guild-button: rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-6)); - --dc-secondary-alt: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-3)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-3))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-chat-header: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-2)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-2))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; -} -.theme-light :is(.colorwaysPreview-modal, .colorwaysPreview-wrapper) { - --dc-overlay-color: 255 255 255; - --dc-overlay-color-inverse: 0 0 0; - --dc-overlay-opacity-1: 0.9; - --dc-overlay-opacity-2: 0.8; - --dc-overlay-opacity-3: 0.7; - --dc-overlay-opacity-4: 0.6; - --dc-overlay-opacity-5: 0.3; - --dc-overlay-opacity-6: 0.15; - --dc-overlay-opacity-hover: 0.7; - --dc-overlay-opacity-hover-inverse: 0.02; - --dc-overlay-opacity-active: 0.65; - --dc-overlay-opacity-active-inverse: 0.03; - --dc-overlay-opacity-selected: 0.6; - --dc-overlay-opacity-selected-inverse: 0.04; - --dc-overlay-opacity-chat: 0.9; - --dc-overlay-opacity-home: 0.7; - --dc-overlay-opacity-home-card: 0.9; - --dc-overlay-opacity-app-frame: var(--dc-overlay-opacity-5); - --dc-guild-button: rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-3)); - --dc-secondary-alt: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-1)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-1))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-chat-header: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-1)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-1))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; -} -.colorwaysPreview-modal, -.colorwaysPreview-wrapper { - --dc-overlay-1: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-1)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-1))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-2: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-2)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-2))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-3: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-3)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-3))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-4: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-4)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-4))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-5: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-5)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-5))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-6: linear-gradient(rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-6)),rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-6))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-hover: linear-gradient(rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-hover-inverse)),rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-hover-inverse))) fixed 0 0/cover,linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-hover)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-hover))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-active: linear-gradient(rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-active-inverse)),rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-active-inverse))) fixed 0 0/cover,linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-active)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-active))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-selected: linear-gradient(rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-selected-inverse)),rgb(var(--dc-overlay-color-inverse)/var(--dc-overlay-opacity-selected-inverse))) fixed 0 0/cover,linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-selected)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-selected))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-chat: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-chat)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-chat))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-home: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-home)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-home))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-home-card: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-home-card)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-home-card))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; - --dc-overlay-app-frame: linear-gradient(rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-app-frame)),rgb(var(--dc-overlay-color)/var(--dc-overlay-opacity-app-frame))) fixed 0 0/cover,var(--gradient-theme-bg) fixed 0 0/cover; -}`; - - -export function gradientBase(accentColor?: string, discordSaturation = false) { - return `@import url(//dablulite.github.io/css-snippets/NitroThemesFix/import.css); -.theme-dark { - --bg-overlay-color: 0 0 0; - --bg-overlay-color-inverse: 255 255 255; - --bg-overlay-opacity-1: 0.85; - --bg-overlay-opacity-2: 0.8; - --bg-overlay-opacity-3: 0.7; - --bg-overlay-opacity-4: 0.5; - --bg-overlay-opacity-5: 0.4; - --bg-overlay-opacity-6: 0.1; - --bg-overlay-opacity-hover: 0.5; - --bg-overlay-opacity-hover-inverse: 0.08; - --bg-overlay-opacity-active: 0.45; - --bg-overlay-opacity-active-inverse: 0.1; - --bg-overlay-opacity-selected: 0.4; - --bg-overlay-opacity-selected-inverse: 0.15; - --bg-overlay-opacity-chat: 0.8; - --bg-overlay-opacity-home: 0.85; - --bg-overlay-opacity-home-card: 0.8; - --bg-overlay-opacity-app-frame: var(--bg-overlay-opacity-4); -} -.theme-light { - --bg-overlay-color: 255 255 255; - --bg-overlay-color-inverse: 0 0 0; - --bg-overlay-opacity-1: 0.9; - --bg-overlay-opacity-2: 0.8; - --bg-overlay-opacity-3: 0.7; - --bg-overlay-opacity-4: 0.6; - --bg-overlay-opacity-5: 0.3; - --bg-overlay-opacity-6: 0.15; - --bg-overlay-opacity-hover: 0.7; - --bg-overlay-opacity-hover-inverse: 0.02; - --bg-overlay-opacity-active: 0.65; - --bg-overlay-opacity-active-inverse: 0.03; - --bg-overlay-opacity-selected: 0.6; - --bg-overlay-opacity-selected-inverse: 0.04; - --bg-overlay-opacity-chat: 0.9; - --bg-overlay-opacity-home: 0.7; - --bg-overlay-opacity-home-card: 0.9; - --bg-overlay-opacity-app-frame: var(--bg-overlay-opacity-5); -} -.children_fc4f04:after, .form_a7d72e:before { - content: none; -} -.scroller_fea3ef { - background: var(--bg-overlay-app-frame,var(--background-tertiary)); -} -.expandedFolderBackground_bc7085 { - background: rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-6)); -} -.wrapper__8436d:not(:hover):not(.selected_ae80f7) .childWrapper_a6ce15 { - background: rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-6)); -} -.folder_bc7085:has(.expandedFolderIconWrapper_bc7085) { - background: var(--bg-overlay-6,var(--background-secondary)); -} -.circleIconButton_db6521:not(.selected_db6521) { - background: rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-6)); -} -.auto_eed6a8::-webkit-scrollbar-thumb, -.thin_eed6a8::-webkit-scrollbar-thumb { - background-size: 200vh; - background-image: -webkit-gradient(linear,left top,left bottom,from(rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-4))),to(rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-4)))),var(--custom-theme-background); - background-image: linear-gradient(rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-4)),rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-4))),var(--custom-theme-background); -} -.auto_eed6a8::-webkit-scrollbar-track { - background-size: 200vh; - background-image: -webkit-gradient(linear,left top,left bottom,from(rgb(var(--bg-overlay-color)/.4)),to(rgb(var(--bg-overlay-color)/.4))),var(--custom-theme-background); - background-image: linear-gradient(rgb(var(--bg-overlay-color)/.4),rgb(var(--bg-overlay-color)/.4)),var(--custom-theme-background); -} -:root:root { - --brand-100-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[100])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[100]) * 10) / 10, 0)}; - --brand-130-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[130])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[130]) * 10) / 10, 0)}%; - --brand-160-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[160])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[160]) * 10) / 10, 0)}%; - --brand-200-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[200])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[200]) * 10) / 10, 0)}%; - --brand-230-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[230])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[230]) * 10) / 10, 0)}%; - --brand-260-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[260])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[260]) * 10) / 10, 0)}%; - --brand-300-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[300])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[300]) * 10) / 10, 0)}%; - --brand-330-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[330])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[330]) * 10) / 10, 0)}%; - --brand-345-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[345])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[345]) * 10) / 10, 0)}%; - --brand-360-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[360])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[360]) * 10) / 10, 0)}%; - --brand-400-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[400])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[400]) * 10) / 10, 0)}%; - --brand-430-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[430])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[430]) * 10) / 10, 0)}%; - --brand-460-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[460])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[460]) * 10) / 10, 0)}%; - --brand-500-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${HexToHSL("#" + accentColor)[2]}%; - --brand-530-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[530])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[530]) * 10) / 10, 100)}%; - --brand-560-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[560])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[560]) * 10) / 10, 100)}%; - --brand-600-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[600])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[600]) * 10) / 10, 100)}%; - --brand-630-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[630])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[630]) * 10) / 10, 100)}%; - --brand-660-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[660])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[660]) * 10) / 10, 100)}%; - --brand-700-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[700])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[700]) * 10) / 10, 100)}%; - --brand-730-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[730])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[730]) * 10) / 10, 100)}%; - --brand-760-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[760])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[760]) * 10) / 10, 100)}%; - --brand-800-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[800])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[800]) * 10) / 10, 100)}%; - --brand-830-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[830])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[830]) * 10) / 10, 100)}%; - --brand-860-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[860])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[860]) * 10) / 10, 100)}%; - --brand-900-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[900])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[900]) * 10) / 10, 100)}%; - --bg-overlay-1: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-1)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-1))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-2: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-2)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-2))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-3: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-3)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-3))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-4: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-4)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-4))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-5: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-5)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-5))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-6: linear-gradient(rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-6)),rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-6))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-hover: linear-gradient(rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-hover-inverse)),rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-hover-inverse))) fixed 0 0/cover,linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-hover)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-hover))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-active: linear-gradient(rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-active-inverse)),rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-active-inverse))) fixed 0 0/cover,linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-active)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-active))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-selected: linear-gradient(rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-selected-inverse)),rgb(var(--bg-overlay-color-inverse)/var(--bg-overlay-opacity-selected-inverse))) fixed 0 0/cover,linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-selected)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-selected))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-chat: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-chat)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-chat))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-home: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-home)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-home))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-home-card: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-home-card)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-home-card))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; - --bg-overlay-app-frame: linear-gradient(rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-app-frame)),rgb(var(--bg-overlay-color)/var(--bg-overlay-opacity-app-frame))) fixed 0 0/cover,var(--custom-theme-background) fixed 0 0/cover; -}`; -} - -export function generateCss(primaryColor: string, secondaryColor: string, tertiaryColor: string, accentColor: string, tintedText: boolean = true, discordSaturation: boolean = true, mutedTextBrightness?: number, name?: string) { - return `/** - * @name ${name} - * @version ${PluginProps.creatorVersion} - * @description Automatically generated Colorway. - * @author ${UserStore.getCurrentUser().username} - * @authorId ${UserStore.getCurrentUser().id} - */ -:root:root { - --brand-100-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[100])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[100]) * 10) / 10, 0)}; - --brand-130-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[130])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[130]) * 10) / 10, 0)}%; - --brand-160-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[160])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[160]) * 10) / 10, 0)}%; - --brand-200-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[200])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[200]) * 10) / 10, 0)}%; - --brand-230-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[230])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[230]) * 10) / 10, 0)}%; - --brand-260-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[260])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[260]) * 10) / 10, 0)}%; - --brand-300-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[300])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[300]) * 10) / 10, 0)}%; - --brand-330-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[330])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[330]) * 10) / 10, 0)}%; - --brand-345-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[345])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[345]) * 10) / 10, 0)}%; - --brand-360-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[360])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[360]) * 10) / 10, 0)}%; - --brand-400-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[400])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[400]) * 10) / 10, 0)}%; - --brand-430-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[430])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[430]) * 10) / 10, 0)}%; - --brand-460-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[460])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[460]) * 10) / 10, 0)}%; - --brand-500-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${HexToHSL("#" + accentColor)[2]}%; - --brand-530-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[530])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[530]) * 10) / 10, 100)}%; - --brand-560-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[560])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[560]) * 10) / 10, 100)}%; - --brand-600-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[600])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[600]) * 10) / 10, 100)}%; - --brand-630-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[630])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[630]) * 10) / 10, 100)}%; - --brand-660-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[660])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[660]) * 10) / 10, 100)}%; - --brand-700-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[700])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[700]) * 10) / 10, 100)}%; - --brand-730-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[730])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[730]) * 10) / 10, 100)}%; - --brand-760-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[760])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[760]) * 10) / 10, 100)}%; - --brand-800-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[800])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[800]) * 10) / 10, 100)}%; - --brand-830-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[830])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[830]) * 10) / 10, 100)}%; - --brand-860-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[860])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[860]) * 10) / 10, 100)}%; - --brand-900-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + accentColor)[1] / 100) * (100 + BrandSatDiffs[900])) * 10) / 10 : HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[900]) * 10) / 10, 100)}%; -} -.theme-dark { - --primary-800-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[800])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - (3.6 * 2), 0)}%; - --primary-730-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[730])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - 3.6, 0)}%; - --primary-700-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${HexToHSL("#" + tertiaryColor)[2]}%; - --primary-660-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + secondaryColor)[1] / 100) * (100 + PrimarySatDiffs[660])) * 10) / 10 : HexToHSL("#" + secondaryColor)[1]}%) ${Math.max(HexToHSL("#" + secondaryColor)[2] - 3.6, 0)}%; - --primary-645-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + secondaryColor)[1] / 100) * (100 + PrimarySatDiffs[645])) * 10) / 10 : HexToHSL("#" + secondaryColor)[1]}%) ${Math.max(HexToHSL("#" + secondaryColor)[2] - 1.1, 0)}%; - --primary-630-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + secondaryColor)[1]}%) ${HexToHSL("#" + secondaryColor)[2]}%; - --primary-600-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${HexToHSL("#" + primaryColor)[2]}%; - --primary-560-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + 3.6, 100)}%; - --primary-530-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[530])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + (3.6 * 2), 100)}%; - --primary-500-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[500])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%) ${mutedTextBrightness || Math.min(HexToHSL("#" + primaryColor)[2] + (3.6 * 3), 100)}%; - --interactive-muted: hsl(${HexToHSL("#" + primaryColor)[0]} ${HexToHSL("#" + primaryColor)[1] / 2}% ${Math.max(Math.min(HexToHSL("#" + primaryColor)[2] - 5, 100), 45)}%); - ${tintedText ? `--primary-460-hsl: 0 calc(var(--saturation-factor, 1)*0%) 50%; - --primary-430: ${HexToHSL("#" + secondaryColor)[0] === 0 ? "gray" : ((HexToHSL("#" + secondaryColor)[2] < 80) ? "hsl(" + HexToHSL("#" + secondaryColor)[0] + `, calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL(`#${primaryColor}`)[1] / 100) * (100 + PrimarySatDiffs[430])) * 10) / 10 : HexToHSL(`#${primaryColor}`)[1]}%), 90%)` : `hsl(${HexToHSL(`#${secondaryColor}`)[0]}, calc(var(--saturation-factor, 1)*100%), 20%)`)}; - --primary-400: ${HexToHSL("#" + secondaryColor)[0] === 0 ? "gray" : ((HexToHSL("#" + secondaryColor)[2] < 80) ? "hsl(" + HexToHSL("#" + secondaryColor)[0] + `, calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL(`#${primaryColor}`)[1] / 100) * (100 + PrimarySatDiffs[400])) * 10) / 10 : HexToHSL(`#${primaryColor}`)[1]}%), 90%)` : `hsl(${HexToHSL(`#${secondaryColor}`)[0]}, calc(var(--saturation-factor, 1)*100%), 20%)`)}; - --primary-360: ${HexToHSL("#" + secondaryColor)[0] === 0 ? "gray" : ((HexToHSL("#" + secondaryColor)[2] < 80) ? "hsl(" + HexToHSL("#" + secondaryColor)[0] + `, calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL(`#${primaryColor}`)[1] / 100) * (100 + PrimarySatDiffs[360])) * 10) / 10 : HexToHSL(`#${primaryColor}`)[1]}%), 90%)` : `hsl(${HexToHSL(`#${secondaryColor}`)[0]}, calc(var(--saturation-factor, 1)*100%), 20%)`)};` : ""} -} -.theme-light { - --white-500-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + 80, 90)}%; - --primary-130-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + secondaryColor)[1]}%) ${Math.min(HexToHSL("#" + secondaryColor)[2] + 80, 85)}%; - --primary-160-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + secondaryColor)[1] / 100) * (100 + PrimarySatDiffs[660])) * 10) / 10 : HexToHSL("#" + secondaryColor)[1]}%) ${Math.min(HexToHSL("#" + secondaryColor)[2] + 76.4, 82.5)}%; - --primary-200-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${Math.min(HexToHSL("#" + tertiaryColor)[2] + 80, 80)}%; -} -.emptyPage_c6b11b, -.scrollerContainer_c6b11b, -.container_f1fd9c, -.header_f1fd9c { - background-color: unset !important; -} -.container_c2efea, -.container_f1fd9c, -.header_f1fd9c { - background: transparent !important; -}${(Math.round(HexToHSL("#" + primaryColor)[2]) > 80) ? `\n\n/*Primary*/ -.theme-dark .container_c2739c, -.theme-dark .body_cd82a7, -.theme-dark .toolbar_fc4f04, -.theme-dark .container_f0fccd, -.theme-dark .messageContent_f9f2ca, -.theme-dark .attachButtonPlus_f298d4, -.theme-dark .username_f9f2ca:not([style]), -.theme-dark .children_fc4f04, -.theme-dark .buttonContainer_f9f2ca, -.theme-dark .listItem_c96c45, -.theme-dark .body_cd82a7 .caret_fc4f04, -.theme-dark .body_cd82a7 .titleWrapper_fc4f04 > h1, -.theme-dark .body_cd82a7 .icon_fc4f04 { - --white-500: black !important; - --interactive-normal: black !important; - --text-normal: black !important; - --text-muted: black !important; - --header-primary: black !important; - --header-secondary: black !important; -} - -.theme-dark .contentRegionScroller_c25c6d :not(.mtk1,.mtk2,.mtk3,.mtk4,.mtk5,.mtk6,.mtk7,.mtk8,.mtk9,.monaco-editor .line-numbers) { - --white-500: black !important; -} - -.theme-dark .container_fc4f04 { - --channel-icon: black; -} - -.theme-dark .callContainer_d880dc { - --white-500: ${(HexToHSL("#" + tertiaryColor)[2] > 80) ? "black" : "white"} !important; -} - -.theme-dark .channelTextArea_a7d72e { - --text-normal: ${(HexToHSL("#" + primaryColor)[2] + 3.6 > 80) ? "black" : "white"}; -} - -.theme-dark .placeholder_a552a6 { - --channel-text-area-placeholder: ${(HexToHSL("#" + primaryColor)[2] + 3.6 > 80) ? "black" : "white"}; - opacity: .6; -} - -.theme-dark .colorwaySelectorIcon { - background-color: black; -} - -.theme-dark .root_f9a4c9 > .header_f9a4c9 > h1 { - color: black; -} -/*End Primary*/`: ""}${(HexToHSL("#" + secondaryColor)[2] > 80) ? `\n\n/*Secondary*/ -.theme-dark .wrapper_cd82a7 *, -.theme-dark .sidebar_a4d4d9 *:not(.hasBanner_fd6364 *), -.theme-dark .members_cbd271 *:not([style]), -.theme-dark .sidebarRegionScroller_c25c6d *, -.theme-dark .header_e06857, -.theme-dark .lookFilled_dd4f85.colorPrimary_dd4f85 { - --white-500: black !important; - --channels-default: black !important; - --channel-icon: black !important; - --interactive-normal: var(--white-500); - --interactive-hover: var(--white-500); - --interactive-active: var(--white-500); -} - -.theme-dark .channelRow_f04d06 { - background-color: var(--background-secondary); -} - -.theme-dark .channelRow_f04d06 * { - --channel-icon: black; -} - -.theme-dark #app-mount .activity_a31c43 { - --channels-default: var(--white-500) !important; -} - -.theme-dark .nameTag_b2ca13 { - --header-primary: black !important; - --header-secondary: ${HexToHSL("#" + secondaryColor)[0] === 0 ? "gray" : ((HexToHSL("#" + secondaryColor)[2] < 80) ? "hsl(" + HexToHSL("#" + secondaryColor)[0] + ", calc(var(--saturation-factor, 1)*100%), 90%)" : "hsl(" + HexToHSL("#" + secondaryColor)[0] + ", calc(var(--saturation-factor, 1)*100%), 20%)")} !important; -} - -.theme-dark .bannerVisible_fd6364 .headerContent_fd6364 { - color: #fff; -} - -.theme-dark .embedFull_b0068a { - --text-normal: black; -} -/*End Secondary*/`: ""}${HexToHSL("#" + tertiaryColor)[2] > 80 ? `\n\n/*Tertiary*/ -.theme-dark .winButton_a934d8, -.theme-dark .searchBar_e0840f *, -.theme-dark .wordmarkWindows_a934d8, -.theme-dark .searchBar_a46bef *, -.theme-dark .searchBarComponent_f0963d { - --white-500: black !important; -} - -.theme-dark [style="background-color: var(--background-secondary);"] { - color: ${HexToHSL("#" + secondaryColor)[2] > 80 ? "black" : "white"}; -} - -.theme-dark .popout_c5b389 > * { - --interactive-normal: black !important; - --header-secondary: black !important; -} - -.theme-dark .tooltip_b6c360 { - --text-normal: black !important; -} -.theme-dark .children_fc4f04 .icon_fc4f04 { - color: var(--interactive-active) !important; -} -/*End Tertiary*/`: ""}${HexToHSL("#" + accentColor)[2] > 80 ? `\n\n/*Accent*/ -.selected_db6521 *, -.selected_ae80f7 *, -#app-mount .lookFilled_dd4f85.colorBrand_dd4f85:not(.buttonColor_adcaac), -.colorDefault_d90b3d.focused_d90b3d, -.row_c5b389:hover, -.colorwayInfoIcon, -.checkmarkCircle_cb7c27 > circle { - --white-500: black !important; -} - -.ColorwaySelectorBtn:hover .vc-pallete-icon { - color: #000 !important; -} - -:root:root { - --mention-foreground: black !important; -} -/*End Accent*/`: ""}`; -} - -export function getAutoPresets(accentColor?: string) { - function hueRotation() { - return `:root:root { - --brand-100-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[100]) * 10) / 10, 0)}; - --brand-130-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[130]) * 10) / 10, 0)}%; - --brand-160-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[160]) * 10) / 10, 0)}%; - --brand-200-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[200]) * 10) / 10, 0)}%; - --brand-230-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[230]) * 10) / 10, 0)}%; - --brand-260-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[260]) * 10) / 10, 0)}%; - --brand-300-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[300]) * 10) / 10, 0)}%; - --brand-330-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[330]) * 10) / 10, 0)}%; - --brand-345-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[345]) * 10) / 10, 0)}%; - --brand-360-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[360]) * 10) / 10, 0)}%; - --brand-400-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[400]) * 10) / 10, 0)}%; - --brand-430-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[430]) * 10) / 10, 0)}%; - --brand-460-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[460]) * 10) / 10, 0)}%; - --brand-500-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${HexToHSL("#" + accentColor)[2]}%; - --brand-530-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[530]) * 10) / 10, 100)}%; - --brand-560-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[560]) * 10) / 10, 100)}%; - --brand-600-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[600]) * 10) / 10, 100)}%; - --brand-630-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[630]) * 10) / 10, 100)}%; - --brand-660-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[660]) * 10) / 10, 100)}%; - --brand-700-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[700]) * 10) / 10, 100)}%; - --brand-730-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[730]) * 10) / 10, 100)}%; - --brand-760-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[760]) * 10) / 10, 100)}%; - --brand-800-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[800]) * 10) / 10, 100)}%; - --brand-830-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[830]) * 10) / 10, 100)}%; - --brand-860-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[860]) * 10) / 10, 100)}%; - --brand-900-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[900]) * 10) / 10, 100)}%; - --primary-800-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*12%) 7%; - --primary-730-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*10%) 13%; - --primary-700-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*10%) 13%; - --primary-660-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*11%) 15%; - --primary-645-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*11%) 16%; - --primary-630-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*11%) 18%; - --primary-600-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*11%) 21%; - --primary-560-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*11%) 24%; - --primary-530-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*11%) 24%; - --primary-500-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*11%) 24%; -}`; - } - - function accentSwap() { - return `:root:root { - --brand-100-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[100]) * 10) / 10, 0)}; - --brand-130-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[130]) * 10) / 10, 0)}%; - --brand-160-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[160]) * 10) / 10, 0)}%; - --brand-200-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[200]) * 10) / 10, 0)}%; - --brand-230-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[230]) * 10) / 10, 0)}%; - --brand-260-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[260]) * 10) / 10, 0)}%; - --brand-300-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[300]) * 10) / 10, 0)}%; - --brand-330-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[330]) * 10) / 10, 0)}%; - --brand-345-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[345]) * 10) / 10, 0)}%; - --brand-360-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[360]) * 10) / 10, 0)}%; - --brand-400-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[400]) * 10) / 10, 0)}%; - --brand-430-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[430]) * 10) / 10, 0)}%; - --brand-460-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.max(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[460]) * 10) / 10, 0)}%; - --brand-500-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${HexToHSL("#" + accentColor)[2]}%; - --brand-530-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[530]) * 10) / 10, 100)}%; - --brand-560-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[560]) * 10) / 10, 100)}%; - --brand-600-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[600]) * 10) / 10, 100)}%; - --brand-630-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[630]) * 10) / 10, 100)}%; - --brand-660-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[660]) * 10) / 10, 100)}%; - --brand-700-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[700]) * 10) / 10, 100)}%; - --brand-730-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[730]) * 10) / 10, 100)}%; - --brand-760-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[760]) * 10) / 10, 100)}%; - --brand-800-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[800]) * 10) / 10, 100)}%; - --brand-830-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[830]) * 10) / 10, 100)}%; - --brand-860-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[860]) * 10) / 10, 100)}%; - --brand-900-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${Math.min(Math.round((HexToHSL("#" + accentColor)[2] + BrandLightDiffs[900]) * 10) / 10, 100)}%; -}`; - } - - function materialYou() { - return `:root:root { - --brand-100-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*90.5%) 56.5; - --brand-130-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*102.2%) 55.2%; - --brand-160-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*98.8%) 53.2%; - --brand-200-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*97.3%) 51.2%; - --brand-230-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*101.6%) 49.3%; - --brand-260-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*100.7%) 46.9%; - --brand-300-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*100.6%) 44.2%; - --brand-330-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*99.4%) 39.9%; - --brand-345-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*99.5%) 37.1%; - --brand-360-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*100.6%) 35.8%; - --brand-400-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*100.6%) 30.1%; - --brand-430-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*100.1%) 28.1%; - --brand-460-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*99.9%) 25.8%; - --brand-500-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*100%) 23%; - --brand-530-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*75.2%) 17.1%; - --brand-560-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*50.1%) 10.7%; - --brand-600-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*41.2%) 2.4%; - --brand-630-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*41.2%) -3.5%; - --brand-660-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*42%) -8.4%; - --brand-700-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*41.8%) -15.8%; - --brand-730-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*41.4%) -17.4%; - --brand-760-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*41.6%) -19.5%; - --brand-800-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*42.7%) -22.3%; - --brand-830-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*42.6%) -26.8%; - --brand-860-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*41.6%) -32.1%; - --brand-900-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*47.5%) -38.6%; - --primary-800-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*10%) 10.8%; - --primary-730-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*8%) 14.4%; - --primary-700-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*16%) 18%; - --primary-660-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*14%) 12.4%; - --primary-645-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*14%) 14.9%; - --primary-630-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*12%) 16%; - --primary-600-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*12%) 12%; - --primary-560-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*12%) 15.6%; - --primary-530-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*12%) 19.2%; - --primary-500-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*12%) 22.8%; - --primary-460-hsl: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*12%) 50%; - --primary-430: hsl(${HexToHSL("#" + accentColor)[0]}, calc(var(--saturation-factor, 1)*12%), 90%); - --primary-400: hsl(${HexToHSL("#" + accentColor)[0]}, calc(var(--saturation-factor, 1)*12%), 90%); - --primary-360: hsl(${HexToHSL("#" + accentColor)[0]}, calc(var(--saturation-factor, 1)*12%), 90%); -} -.emptyPage_c6b11b, -.scrollerContainer_c6b11b, -.container_f1fd9c, -.header_f1fd9c { - background-color: unset !important; -}`; - } - - return { - hueRotation: { - name: "Hue Rotation", - id: "hueRotation", - preset: hueRotation - }, - accentSwap: { - name: "Accent Swap", - id: "accentSwap", - preset: accentSwap - }, - materialYou: { - name: "Material You", - id: "materialYou", - preset: materialYou - } - } as { [key: string]: { name: string, id: string, preset: () => string; }; }; -} - -export function getPreset( - primaryColor?: string, - secondaryColor?: string, - tertiaryColor?: string, - accentColor?: string -): { - [preset: string]: { - name: string, - preset: (...args: any) => string | { full: string, base: string; }, - id: string, - colors: string[], - calculated?: { - accent?: string, - primary?: string, - secondary?: string, - tertiary?: string; - }; - }; -} { - function cyanLegacy(discordSaturation = false) { - return `:root:root { - --cyan-accent-color: #${accentColor}; - --cyan-background-primary: hsl(${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${HexToHSL("#" + primaryColor)[2]}%/40%); - --cyan-background-secondary: hsl(${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${Math.min(HexToHSL("#" + tertiaryColor)[2] + (3.6 * 2), 100)}%); -}`; - } - - function cyan(discordSaturation = false) { - return `:root:root { - --cyan-accent-color: #${accentColor}; - --cyan-background-primary: hsl(${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${HexToHSL("#" + primaryColor)[2]}%/60%); - --cyan-second-layer: hsl(${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${Math.min(HexToHSL("#" + tertiaryColor)[2] + (3.6 * 2), 100)}%/60%); -}`; - } - - function nexusRemastered(discordSaturation = false) { - return `:root:root { - --nexus-accent-color: #${accentColor}; - --nexus-background-secondary: hsl(${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[800])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - (3.6 * 2), 0)}%); - --nexus-background-elevated: hsl(${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[800])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - (3.6 * 2), 0)}%); - --nexus-background-floating: hsl(${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[800])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - (3.6 * 2), 0)}%); - --nexus-background-tertiary: hsl(${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${HexToHSL("#" + tertiaryColor)[2]}%); - --home-background: hsl(${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${HexToHSL("#" + tertiaryColor)[2]}%); - --nexus-background-primary: hsl(${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${HexToHSL("#" + primaryColor)[2]}%); - --primary-800-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[800])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - (3.6 * 2), 0)}%; - --primary-730-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[730])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - 3.6, 0)}%; - --primary-700-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${HexToHSL("#" + tertiaryColor)[2]}%; - --primary-660-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + secondaryColor)[1] / 100) * (100 + PrimarySatDiffs[660])) * 10) / 10 : HexToHSL("#" + secondaryColor)[1]}%) ${Math.max(HexToHSL("#" + secondaryColor)[2] - 3.6, 0)}%; - --primary-645-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + secondaryColor)[1] / 100) * (100 + PrimarySatDiffs[645])) * 10) / 10 : HexToHSL("#" + secondaryColor)[1]}%) ${Math.max(HexToHSL("#" + secondaryColor)[2] - 1.1, 0)}%; - --primary-630-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + secondaryColor)[1]}%) ${HexToHSL("#" + secondaryColor)[2]}%; - --primary-600-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${HexToHSL("#" + primaryColor)[2]}%; - --primary-560-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + 3.6, 100)}%; - --primary-530-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[530])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + (3.6 * 2), 100)}%; - --primary-500-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[500])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + (3.6 * 3), 100)}%; - --primary-200: ${HexToHSL("#" + secondaryColor)[0] === 0 ? "gray" : ((HexToHSL("#" + secondaryColor)[2] < 80) ? "hsl(" + HexToHSL("#" + secondaryColor)[0] + `, calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[200])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%), 90%)` : "hsl(" + HexToHSL("#" + secondaryColor)[0] + ", calc(var(--saturation-factor, 1)*100%), 20%)")} -} -.theme-dark { - --background-tertiary: var(--primary-700) !important; -} -.theme-light { - --background-tertiary: var(--primary-200) !important; -}`; - } - - function modular(discordSaturation = false) { - return `:root:root { - --brand-experiment: #${accentColor}; - --primary-800-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[800])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - (3.6 * 2), 0)}%; - --primary-730-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + tertiaryColor)[1] / 100) * (100 + PrimarySatDiffs[730])) * 10) / 10 : HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(HexToHSL("#" + tertiaryColor)[2] - 3.6, 0)}%; - --primary-700-hsl: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${HexToHSL("#" + tertiaryColor)[2]}%; - --primary-660-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + secondaryColor)[1] / 100) * (100 + PrimarySatDiffs[660])) * 10) / 10 : HexToHSL("#" + secondaryColor)[1]}%) ${Math.max(HexToHSL("#" + secondaryColor)[2] - 3.6, 0)}%; - --primary-645-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + secondaryColor)[1] / 100) * (100 + PrimarySatDiffs[645])) * 10) / 10 : HexToHSL("#" + secondaryColor)[1]}%) ${Math.max(HexToHSL("#" + secondaryColor)[2] - 1.1, 0)}%; - --primary-630-hsl: ${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + secondaryColor)[1]}%) ${HexToHSL("#" + secondaryColor)[2]}%; - --primary-600-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${HexToHSL("#" + primaryColor)[2]}%; - --primary-560-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + 3.6, 100)}%; - --primary-530-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[530])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + (3.6 * 2), 100)}% !important; - --primary-500-hsl: ${HexToHSL("#" + primaryColor)[0]} calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[500])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%) ${Math.min(HexToHSL("#" + primaryColor)[2] + (3.6 * 3), 100)}% !important; - --primary-330: ${HexToHSL("#" + secondaryColor)[0] === 0 ? "gray" : ((HexToHSL("#" + secondaryColor)[2] < 80) ? "hsl(" + HexToHSL("#" + secondaryColor)[0] + `, calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[330])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%), 90%)` : "hsl(" + HexToHSL("#" + secondaryColor)[0] + ", calc(var(--saturation-factor, 1)*100%), 20%)")}; - --primary-360: ${HexToHSL("#" + secondaryColor)[0] === 0 ? "gray" : ((HexToHSL("#" + secondaryColor)[2] < 80) ? "hsl(" + HexToHSL("#" + secondaryColor)[0] + `, calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[360])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%), 90%)` : "hsl(" + HexToHSL("#" + secondaryColor)[0] + ", calc(var(--saturation-factor, 1)*100%), 20%)")}; - --primary-400: ${HexToHSL("#" + secondaryColor)[0] === 0 ? "gray" : ((HexToHSL("#" + secondaryColor)[2] < 80) ? "hsl(" + HexToHSL("#" + secondaryColor)[0] + `, calc(var(--saturation-factor, 1)*${discordSaturation ? Math.round(((HexToHSL("#" + primaryColor)[1] / 100) * (100 + PrimarySatDiffs[400])) * 10) / 10 : HexToHSL("#" + primaryColor)[1]}%), 90%)` : "hsl(" + HexToHSL("#" + secondaryColor)[0] + ", calc(var(--saturation-factor, 1)*100%), 20%)")} -}`; - } - - function virtualBoy(discordSaturation = false) { - return `:root:root { - --VBaccent: ${HexToHSL("#" + accentColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + accentColor)[1]}%) ${HexToHSL("#" + accentColor)[2]}%; - --VBaccent-muted: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${Math.max(((HexToHSL("#" + tertiaryColor)[2]) - 10), 0)}%; - --VBaccent-dimmest: ${HexToHSL("#" + tertiaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + tertiaryColor)[1]}%) ${Math.min((HexToHSL("#" + tertiaryColor)[2] + (3.6 * 5) - 3), 100)}%; -}`; - } - - function solana(discordSaturation = false) { - return `:root:root { - --accent-hue: ${HexToHSL("#" + accentColor)[0]}; - --accent-saturation: calc(var(--saturation-factor, 1)${HexToHSL("#" + accentColor)[1]}%); - --accent-brightness: ${HexToHSL("#" + accentColor)[2]}%; - --background-accent-hue: ${HexToHSL("#" + primaryColor)[0]}; - --background-accent-saturation: calc(var(--saturation-factor, 1)${HexToHSL("#" + primaryColor)[1]}%); - --background-accent-brightness: ${HexToHSL("#" + primaryColor)[2]}%; - --background-overlay-opacity: 0%; -}`; - } - - function gradientType1(discordSaturation = false) { - return { - full: `${gradientBase(accentColor, discordSaturation)} - :root:root { - --custom-theme-background: linear-gradient(239.16deg, #${primaryColor} 10.39%, #${secondaryColor} 26.87%, #${tertiaryColor} 48.31%, hsl(${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + secondaryColor)[1]}%) ${Math.min(HexToHSL("#" + secondaryColor)[2] + 3.6, 100)}%) 64.98%, #${primaryColor} 92.5%); - }`, - base: `239.16deg, #${primaryColor} 10.39%, #${secondaryColor} 26.87%, #${tertiaryColor} 48.31%, hsl(${HexToHSL("#" + secondaryColor)[0]} calc(var(--saturation-factor, 1)*${HexToHSL("#" + secondaryColor)[1]}%) ${Math.min(HexToHSL("#" + secondaryColor)[2] + 3.6, 100)}%) 64.98%, #${primaryColor} 92.5%` - }; - } - - function gradientType2(discordSaturation = false) { - return { - full: `${gradientBase(accentColor, discordSaturation)} - :root:root { - --custom-theme-background: linear-gradient(48.17deg, #${primaryColor} 11.21%, #${secondaryColor} 61.92%); - }`, base: `48.17deg, #${primaryColor} 11.21%, #${secondaryColor} 61.92%` - }; - } - - return { - default: { - name: "Default", - preset: generateCss, - id: "default", - colors: ["accent", "primary", "secondary", "tertiary"] - }, - cyan: { - name: "Cyan", - preset: cyan, - id: "cyan", - colors: ["accent", "primary", "secondary"] - }, - cyanLegacy: { - name: "Cyan 1 (Legacy)", - preset: cyanLegacy, - id: "cyanLegacy", - colors: ["accent", "primary", "secondary"] - }, - nexusRemastered: { - name: "Nexus Remastered", - preset: nexusRemastered, - id: "nexusRemastered", - colors: ["accent", "primary", "secondary", "tertiary"] - }, - virtualBoy: { - name: "Virtual Boy", - preset: virtualBoy, - id: "virtualBoy", - colors: ["accent", "tertiary"] - }, - modular: { - name: "Modular", - preset: modular, - id: "modular", - colors: ["accent", "primary", "secondary", "tertiary"] - }, - solana: { - name: "Solana", - preset: solana, - id: "solana", - colors: ["accent", "primary"] - }, - gradientType1: { - name: "Gradient Type 1", - preset: gradientType1, - id: "gradientType1", - colors: ["accent", "primary", "secondary", "tertiary"] - }, - gradientType2: { - name: "Gradient Type 2", - preset: gradientType2, - id: "gradientType2", - colors: ["accent", "primary", "secondary"] - }, - hueRotation: { - name: "Hue Rotation", - preset: getAutoPresets(accentColor).hueRotation.preset, - id: "hueRotation", - colors: ["accent"], - calculated: { - primary: `hsl(${HexToHSL("#" + accentColor)[0]} 11% 21%)`, - secondary: `hsl(${HexToHSL("#" + accentColor)[0]} 11% 18%)`, - tertiary: `hsl(${HexToHSL("#" + accentColor)[0]} 10% 13%)` - } - }, - accentSwap: { - name: "Accent Swap", - preset: getAutoPresets(accentColor).accentSwap.preset, - id: "accentSwap", - colors: ["accent"] - }, - materialYou: { - name: "Material You", - preset: getAutoPresets(accentColor).materialYou.preset, - id: "materialYou", - colors: ["accent"], - calculated: { - primary: `hsl(${HexToHSL("#" + accentColor)[0]} 12% 12%)`, - secondary: `hsl(${HexToHSL("#" + accentColor)[0]} 12% 16%)`, - tertiary: `hsl(${HexToHSL("#" + accentColor)[0]} 16% 18%)` - } - } - }; -} -export const gradientPresetIds = [ - "gradientType1", - "gradientType2" -]; diff --git a/src/equicordplugins/discordColorways/defaultsLoader.tsx b/src/equicordplugins/discordColorways/defaultsLoader.tsx deleted file mode 100644 index 5dce8dd6..00000000 --- a/src/equicordplugins/discordColorways/defaultsLoader.tsx +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore } from "."; -import { defaultColorwaySource, nullColorwayObj } from "./constants"; - -export default async function () { - const [ - customColorways, - colorwaySourceFiles, - showColorwaysButton, - onDemandWays, - onDemandWaysTintedText, - onDemandWaysDiscordSaturation, - onDemandWaysOsAccentColor, - activeColorwayObject, - colorwaysPluginTheme, - colorwaysBoundManagers, - colorwaysManagerAutoconnectPeriod, - colorwaysManagerDoAutoconnect - ] = await DataStore.getMany([ - "customColorways", - "colorwaySourceFiles", - "showColorwaysButton", - "onDemandWays", - "onDemandWaysTintedText", - "onDemandWaysDiscordSaturation", - "onDemandWaysOsAccentColor", - "activeColorwayObject", - "colorwaysPluginTheme", - "colorwaysBoundManagers", - "colorwaysManagerAutoconnectPeriod", - "colorwaysManagerDoAutoconnect" - ]); - - const defaults = [ - { - name: "colorwaysManagerAutoconnectPeriod", - value: colorwaysManagerAutoconnectPeriod, - default: 3000 - }, - { - name: "colorwaysManagerDoAutoconnect", - value: colorwaysManagerDoAutoconnect, - default: true - }, - { - name: "showColorwaysButton", - value: showColorwaysButton, - default: false - }, - { - name: "onDemandWays", - value: onDemandWays, - default: false - }, - { - name: "onDemandWaysTintedText", - value: onDemandWaysTintedText, - default: true - }, - { - name: "onDemandWaysDiscordSaturation", - value: onDemandWaysDiscordSaturation, - default: false - }, - { - name: "onDemandWaysOsAccentColor", - value: onDemandWaysOsAccentColor, - default: false - }, - { - name: "colorwaysBoundManagers", - value: colorwaysBoundManagers, - default: [] - }, - { - name: "activeColorwayObject", - value: activeColorwayObject, - default: nullColorwayObj - }, - { - name: "colorwaysPluginTheme", - value: colorwaysPluginTheme, - default: "discord" - } - ]; - - defaults.forEach(({ name, value, default: def }) => { - if (!value) DataStore.set(name, def); - }); - - if (customColorways) { - if (!customColorways[0].colorways) { - DataStore.set("customColorways", [{ name: "Custom", colorways: customColorways }]); - } - } else { - DataStore.set("customColorways", []); - } - - if (colorwaySourceFiles) { - if (typeof colorwaySourceFiles[0] === "string") { - DataStore.set("colorwaySourceFiles", colorwaySourceFiles.map((sourceURL: string, i: number) => { - return { name: sourceURL === defaultColorwaySource ? "Project Colorway" : `Source #${i}`, url: sourceURL === "https://raw.githubusercontent.com/DaBluLite/ProjectColorway/master/index.json" ? defaultColorwaySource : sourceURL }; - })); - } - } else { - DataStore.set("colorwaySourceFiles", [{ - name: "Project Colorway", - url: defaultColorwaySource - }]); - } - -} diff --git a/src/equicordplugins/discordColorways/index.tsx b/src/equicordplugins/discordColorways/index.tsx deleted file mode 100644 index 6d4a53ab..00000000 --- a/src/equicordplugins/discordColorways/index.tsx +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -// Plugin Imports -import * as $DataStore from "@api/DataStore"; -import { addAccessory, removeAccessory } from "@api/MessageAccessories"; -import { addServerListElement, removeServerListElement, ServerListRenderPosition } from "@api/ServerList"; -import { disableStyle, enableStyle } from "@api/Styles"; -import { Devs, EquicordDevs } from "@utils/constants"; -import { openModal } from "@utils/modal"; -import definePlugin from "@utils/types"; -import { - i18n, - SettingsRouter -} from "@webpack/common"; -import { FluxEvents as $FluxEvents } from "@webpack/types"; -// Mod-specific imports -import { - CSSProperties as $CSSProperties, - ReactNode as $ReactNode -} from "react"; - -import { ColorwayCSS } from "./colorwaysAPI"; -import ColorwayID from "./components/ColorwayID"; -import ColorwaysButton from "./components/ColorwaysButton"; -import CreatorModal from "./components/CreatorModal"; -import PCSMigrationModal from "./components/PCSMigrationModal"; -import Selector from "./components/Selector"; -import OnDemandWaysPage from "./components/SettingsTabs/OnDemandPage"; -import SettingsPage from "./components/SettingsTabs/SettingsPage"; -import SourceManager from "./components/SettingsTabs/SourceManager"; -import Store from "./components/SettingsTabs/Store"; -import Spinner from "./components/Spinner"; -import { defaultColorwaySource } from "./constants"; -import defaultsLoader from "./defaultsLoader"; -import style from "./style.css?managed"; -import discordTheme from "./theme.discord.css?managed"; -import { ColorPickerProps, ColorwayObject } from "./types"; -import { connect } from "./wsClient"; - -export const DataStore = $DataStore; -export type ReactNode = $ReactNode; -export type CSSProperties = $CSSProperties; -export type FluxEvents = $FluxEvents; -export { closeModal, openModal } from "@utils/modal"; -export { - Clipboard, - FluxDispatcher, - i18n, - ReactDOM, - SettingsRouter, - Slider, - Toasts, - useCallback, - useEffect, - useReducer, - useRef, - UserStore, - useState, - useStateFromStores -} from "@webpack/common"; - -export let ColorPicker: React.FunctionComponent = () => { - return ; -}; - -defaultsLoader(); - -export const PluginProps = { - pluginVersion: "6.1.0", - clientMod: "Vencord User Plugin", - UIVersion: "2.0.0", - creatorVersion: "1.20" -}; - -export default definePlugin({ - name: "DiscordColorways", - description: "A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways", - authors: [EquicordDevs.DaBluLite, Devs.ImLvna], - dependencies: ["ServerListAPI", "MessageAccessoriesAPI"], - pluginVersion: PluginProps.pluginVersion, - toolboxActions: { - "Open Colorway Creator": () => openModal(props => ), - "Open Settings": () => SettingsRouter.open("ColorwaysSettings"), - }, - patches: [ - // Credits to Kyuuhachi for the BetterSettings plugin patches - { - find: "this.renderArtisanalHack()", - replacement: { - match: /createPromise:\(\)=>([^:}]*?),webpackId:"?\d+"?,name:(?!="CollectiblesShop")"[^"]+"/g, - replace: "$&,_:$1", - predicate: () => true - } - - }, - { - find: "Messages.USER_SETTINGS_WITH_BUILD_OVERRIDE.format", - replacement: { - match: /(\i)\(this,"handleOpenSettingsContextMenu",.{0,100}?null!=\i&&.{0,100}?(await Promise\.all[^};]*?\)\)).*?,(?=\1\(this)/, - replace: "$&(async ()=>$2)()," - }, - predicate: () => true - }, - { - find: "colorPickerFooter:", - replacement: { - match: /function (\i).{0,200}colorPickerFooter:/, - replace: "$self.ColorPicker=$1;$&", - }, - } - ], - - set ColorPicker(e) { - ColorPicker = e; - }, - - isRightSpot({ header, settings }: { header?: string; settings?: string[]; }) { - const firstChild = settings?.[0]; - // lowest two elements... sanity backup - if (firstChild === "LOGOUT" || firstChild === "SOCIAL_LINKS") return true; - - const settingsLocation = "belowNitro"; - - if (!header) return; - - const names = { - top: i18n.Messages.USER_SETTINGS, - aboveNitro: i18n.Messages.BILLING_SETTINGS, - belowNitro: i18n.Messages.APP_SETTINGS, - aboveActivity: i18n.Messages.ACTIVITY_SETTINGS - }; - return header === names[settingsLocation]; - }, - - patchedSettings: new WeakSet(), - - addSettings(elements: any[], element: { header?: string; settings: string[]; }, sectionTypes: Record) { - if (this.patchedSettings.has(elements) || !this.isRightSpot(element)) return; - - this.patchedSettings.add(elements); - - elements.push(...this.makeSettingsCategories(sectionTypes)); - }, - - makeSettingsCategories(SectionTypes: Record) { - return [ - { - section: SectionTypes.HEADER, - label: "Discord Colorways", - className: "vc-settings-header" - }, - { - section: "ColorwaysSelector", - label: "Colorways", - element: () => , - className: "dc-colorway-selector" - }, - { - section: "ColorwaysSettings", - label: "Settings", - element: () => , - className: "dc-colorway-settings" - }, - { - section: "ColorwaysSourceManager", - label: "Sources", - element: () => , - className: "dc-colorway-sources-manager" - }, - { - section: "ColorwaysOnDemand", - label: "On-Demand", - element: () => , - className: "dc-colorway-ondemand" - }, - { - section: "ColorwaysStore", - label: "Store", - element: () => , - className: "dc-colorway-store" - }, - { - section: SectionTypes.DIVIDER - } - ].filter(Boolean); - }, - - ColorwaysButton: () => , - - async start() { - const customSettingsSections = ( - Vencord.Plugins.plugins.Settings as any as { - customSections: ((ID: Record) => any)[]; - } - ).customSections; - - const ColorwaysSelector = () => ({ - section: "ColorwaysSelector", - label: "Colorways Selector", - element: () => , - className: "dc-colorway-selector" - }); - const ColorwaysSettings = () => ({ - section: "ColorwaysSettings", - label: "Colorways Settings", - element: () => , - className: "dc-colorway-settings" - }); - const ColorwaysSourceManager = () => ({ - section: "ColorwaysSourceManager", - label: "Colorways Sources", - element: () => , - className: "dc-colorway-sources-manager" - }); - const ColorwaysOnDemand = () => ({ - section: "ColorwaysOnDemand", - label: "Colorways On-Demand", - element: () => , - className: "dc-colorway-ondemand" - }); - const ColorwaysStore = () => ({ - section: "ColorwaysStore", - label: "Colorways Store", - element: () => , - className: "dc-colorway-store" - }); - - customSettingsSections.push(ColorwaysSelector, ColorwaysSettings, ColorwaysSourceManager, ColorwaysOnDemand, ColorwaysStore); - - addServerListElement(ServerListRenderPosition.Above, this.ColorwaysButton); - - connect(); - - enableStyle(style); - enableStyle(discordTheme); - ColorwayCSS.set((await DataStore.get("activeColorwayObject") as ColorwayObject).css || ""); - - if ((await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]).map(i => i.url).includes("https://raw.githubusercontent.com/DaBluLite/ProjectColorway/master/index.json") || (!(await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]).map(i => i.url).includes("https://raw.githubusercontent.com/DaBluLite/ProjectColorway/master/index.json") && !(await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]).map(i => i.url).includes("https://raw.githubusercontent.com/ProjectColorway/ProjectColorway/master/index.json"))) { - DataStore.set("colorwaySourceFiles", [{ name: "Project Colorway", url: defaultColorwaySource }, ...(await DataStore.get("colorwaySourceFiles") as { name: string, url: string; }[]).filter(i => i.name !== "Project Colorway")]); - openModal(props => ); - } - - addAccessory("colorway-id-card", props => ); - }, - stop() { - removeServerListElement(ServerListRenderPosition.Above, this.ColorwaysButton); - disableStyle(style); - disableStyle(discordTheme); - ColorwayCSS.remove(); - removeAccessory("colorway-id-card"); - const customSettingsSections = ( - Vencord.Plugins.plugins.Settings as any as { - customSections: ((ID: Record) => any)[]; - } - ).customSections; - - const i = customSettingsSections.findIndex( - section => section({}).id === ("ColorwaysSelector" || "ColorwaysSettings" || "ColorwaysSourceManager" || "ColorwaysOnDemand" || "ColorwaysStore") - ); - - if (i !== -1) customSettingsSections.splice(i, 1); - }, -}); diff --git a/src/equicordplugins/discordColorways/style.css b/src/equicordplugins/discordColorways/style.css deleted file mode 100644 index 623aae80..00000000 --- a/src/equicordplugins/discordColorways/style.css +++ /dev/null @@ -1,1847 +0,0 @@ -/* stylelint-disable no-descending-specificity */ -/* stylelint-disable declaration-block-no-redundant-longhand-properties */ -/* stylelint-disable selector-id-pattern */ -/* stylelint-disable selector-class-pattern */ -@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css"); - -.ColorwaySelectorBtn { - height: 48px; - width: 48px; - border-radius: 50px; - display: flex; - justify-content: center; - align-items: center; - transition: 0.15s ease-out; - background-color: var(--background-primary); - cursor: pointer; - color: var(--text-normal); -} - -.ColorwaySelectorBtn:hover { - background-color: var(--brand-500); - border-radius: 16px; -} - -.discordColorwayPreviewColorContainer { - display: flex; - flex-flow: wrap; - flex-direction: row; - overflow: hidden; - border-radius: 50%; - width: 56px; - height: 56px; - box-shadow: 0 0 0 1.5px var(--interactive-normal); - box-sizing: border-box; -} - -.discordColorwayPreviewColor { - width: 50%; - height: 50%; -} - -.discordColorwayPreviewColorContainer:not(:has(> .discordColorwayPreviewColor:nth-child(2))) - > .discordColorwayPreviewColor { - height: 100%; - width: 100%; -} - -.discordColorwayPreviewColorContainer:not(:has(> .discordColorwayPreviewColor:nth-child(3))) - > .discordColorwayPreviewColor { - height: 100%; -} - -.discordColorwayPreviewColorContainer:not(:has(> .discordColorwayPreviewColor:nth-child(4))) - > .discordColorwayPreviewColor:nth-child(3) { - width: 100%; -} - -.ColorwaySelectorWrapper { - position: relative; - display: flex; - gap: 8px; - width: 100%; - scrollbar-width: none !important; - flex-direction: column; - padding: 0 16px !important; - box-sizing: border-box; - overflow: hidden auto; -} - -.ColorwaySelectorWrapper::-webkit-scrollbar { - width: 0; -} - -.colorwaySelectorModal, -.colorwayModal { - width: 90% !important; - height: 90% !important; - border-radius: 8px; - border: 1px solid #a6a6a6f0; - display: flex; - flex-direction: row; - background-color: #090909; - margin: 0 auto; - pointer-events: all; - position: relative; - animation: show-modal 0.2s ease-in-out; -} - -@keyframes reveal-modal { - from { - translate: 0 -20px; - } - - to { - translate: 0; - } -} - -@keyframes reveal-modal-backdrop { - from { - opacity: 0; - } - - to { - opacity: 0.75; - } -} - -.colorwaysModalBackdrop { - background-color: #707070; - opacity: 0.75; - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1; - transition: 0.4s ease; - animation: reveal-modal-backdrop 0.4s ease; - pointer-events: all; -} - -.colorwayModal { - flex-direction: column; -} - -.colorwaySelectorModal.closing, -.colorwayModal.closing, -.colorwaysPreview-modal.closing, -.colorwaysModal.closing { - animation: close-modal 0.2s ease-in-out; - transform: scale(0.5); - opacity: 0; -} - -.colorwaySelectorModal.hidden, -.colorwayModal.hidden, -.colorwaysPreview-modal.hidden, -.colorwaysModal.hidden { - animation: close-modal 0.2s ease-in-out; - transform: scale(0.5); - opacity: 0; -} - -@keyframes show-modal { - 0% { - transform: scale(0.7); - opacity: 0; - } - - 75% { - transform: scale(1.009); - opacity: 1; - } - - 100% { - transform: scale(1); - opacity: 1; - } -} - -@keyframes close-modal { - from { - transform: scale(1); - opacity: 1; - } - - to { - transform: scale(0.7); - opacity: 0; - } -} - -.colorwaysSettingsDivider { - width: 100%; - height: 1px; - border-top: thin solid #fff; - margin-top: 20px; -} - -.colorwaysSettings-switch { - background-color: rgb(85 87 94); - flex: 0 0 auto; - position: relative; - border-radius: 14px; - width: 40px; - height: 24px; - transition: 0.15s ease; - cursor: pointer; -} - -.colorwaysSettings-switch.checked { - background-color: #fff; -} - -.colorwaySwitch-label { - flex: 1; - display: block; - overflow: hidden; - margin-top: 0; - margin-bottom: 0; - color: #fff; - line-height: 24px; - font-size: 16px; - font-weight: 500; - word-wrap: break-word; - cursor: pointer; -} - -.colorwaysNote { - color: #fff; - opacity: 0.5; -} - -.colorwayModal-selectorHeader { - display: flex; - width: 100%; - padding: 16px; - padding-bottom: 8px; - box-sizing: border-box; - flex-direction: column; - gap: 8px; -} - -.colorwayModalContent { - display: flex; - flex-direction: column; - width: 100%; - height: 100%; -} - -.colorwaySelectorSidebar-tab { - width: 48px; - height: 48px; - border-radius: 8px; - cursor: pointer; - transition: 0.2s ease; - border: 1px solid transparent; - display: flex; - align-items: center; - justify-content: center; - font-size: 24px; -} - -.colorwaysPillButton { - padding: 4px 12px; - border-radius: 16px; - background-color: #101010; - color: #fff; - transition: 0.2s ease; - cursor: pointer; - display: flex; - gap: 0.5rem; - justify-content: center; - align-items: center; - width: fit-content; - height: 32px; -} - -.colorwaysPillButton.colorwaysPillButton-onSurface { - background-color: #1a1a1a; -} - -.colorwaysPillButton.colorwaysPillButton-icon { - padding: 4px; -} - -.colorwaysPillButton:hover { - background-color: #2a2a2a; -} - -.colorwaySelectorSidebar-tab:hover { - background-color: #2a2a2a; -} - -.colorwaySelectorSidebar-tab.active { - background-color: #0a0a0a; - border-color: #a6a6a6; -} - -.colorwaySelectorSidebar { - background-color: #101010; - color: #fff; - box-sizing: border-box; - height: 100%; - flex: 0 0 auto; - padding: 16px; - display: flex; - flex-direction: column; - gap: 8px; - border-top-left-radius: 8px; - border-bottom-left-radius: 8px; -} - -.colorwaySelectorModalContent { - display: flex; - flex-direction: column; - width: 100%; - height: 100%; - overflow: visible !important; - padding: 0 16px !important; -} - -.ColorwaySelectorBtnContainer { - position: relative; - margin: 0 0 8px; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - width: 72px; -} - -.colorwayInfoIconContainer { - height: 22px; - width: 22px; - background-color: var(--brand-500); - position: absolute; - top: -1px; - left: -1px; - border-radius: 50%; - opacity: 0; - z-index: +1; - color: var(--white-500); - padding: 1px; - box-sizing: border-box; -} - -.colorwayInfoIconContainer:hover { - background-color: var(--brand-experiment-560); -} - -.discordColorway:hover .colorwayInfoIconContainer { - opacity: 1; - transition: 0.15s; -} - -.colorwayCreator-swatch { - display: flex; - align-items: center; - justify-content: center; - height: 50px; - border-radius: 4px; - box-sizing: border-box; - border: none; - width: 100%; - position: relative; - color: #fff; -} - -.colorwayCreator-swatchName { - color: currentcolor; - pointer-events: none; -} - -.colorwayCreator-colorPreviews { - width: 100%; - height: fit-content; - display: flex; - flex-direction: row; - justify-content: space-between; - gap: 8px; - position: relative; - box-sizing: border-box; -} - -.colorwayCreator-colorInput { - width: 1px; - height: 1px; - opacity: 0; - position: absolute; - pointer-events: none; -} - -.colorwayCreator-menuWrapper { - display: flex; - flex-direction: column; - gap: 8px; - padding: 20px 16px !important; - overflow: visible !important; - min-height: unset; -} - -.colorwayCreator-modal { - width: 620px !important; - max-width: 620px; - max-height: unset !important; -} - -.colorways-creator-module-warning { - color: var(--brand-500); -} - -.colorwayCreator-colorPreviews > [class^="colorSwatch"], -.colorwayCreator-colorPreviews > [class^="colorSwatch"] > [class^="swatch"] { - width: 100%; - border: none; - position: relative; -} - -.colorwaysPicker-colorLabel { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - display: flex; - align-items: center; - justify-content: center; - pointer-events: none; -} - -.colorwayCreator-colorPreviews > .colorSwatch-2UxEuG:has([fill="var(--primary-530)"]) > .colorwaysPicker-colorLabel { - color: var(--primary-530); -} - -.colorwaySelector-noDisplay { - display: none; -} - -.colorwayInfo-wrapper { - display: flex; - flex-direction: column; - color: var(--header-primary); -} - -.colorwayInfo-colorSwatches { - width: 100%; - height: 46px; - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - margin: 12px 0; - gap: 8px; -} - -.colorwayInfo-colorSwatch { - display: flex; - width: 100px; - height: 38px; - border-radius: 3px; - cursor: pointer; - position: relative; - transition: 0.15s; -} - -.colorwayInfo-colorSwatch:hover { - filter: brightness(0.8); -} - -.colorwayInfo-row { - font-weight: 400; - font-size: 20px; - color: var(--header-secondary); - margin-bottom: 4px; - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - gap: 8px; - border-radius: 4px; - background-color: var(--background-secondary); - padding: 8px 12px; -} - -.colorwayInfo-css { - flex-direction: column; - align-items: start; -} - -.colorwayInfo-cssCodeblock { - border-radius: 4px; - border: 1px solid var(--background-accent); - padding: 3px 6px; - white-space: pre; - max-height: 400px; - overflow: auto; - font-size: 0.875rem; - line-height: 1.125rem; - width: 100%; - box-sizing: border-box; -} - -.colorwayInfo-cssCodeblock::-webkit-scrollbar { - width: 8px; - height: 8px; -} - -.colorwayInfo-cssCodeblock::-webkit-scrollbar-corner { - background-color: transparent; -} - -.colorwayInfo-cssCodeblock::-webkit-scrollbar-thumb { - background-color: var(--scrollbar-auto-thumb); - min-height: 40px; -} - -.colorwayInfo-cssCodeblock::-webkit-scrollbar-thumb, -.colorwayInfo-cssCodeblock::-webkit-scrollbar-track { - border: 2px solid transparent; - background-clip: padding-box; - border-radius: 8px; -} - -.colorwayInfo-cssCodeblock::-webkit-scrollbar-track { - margin-bottom: 8px; -} - -.colorwaysCreator-settingCat { - display: flex; - flex-direction: column; - padding: 10px; - border-radius: 8px; - background-color: #1a1a1a; - box-sizing: border-box; - max-height: 250px; - overflow: hidden overlay; -} - -.colorwaysColorpicker-settingCat { - padding: 0; - background-color: transparent; - border-radius: 0; -} - -.colorwaysColorpicker-search { - width: 100%; -} - -.colorwaysCreator-settingItm { - display: flex; - flex-direction: row; - align-items: center; - width: 100%; - border-radius: 4px; - cursor: pointer; - box-sizing: border-box; - padding: 8px; - justify-content: space-between; -} - -.colorwaysCreator-settingItm:hover { - background-color: var(--background-modifier-hover); -} - -.colorwaysCreator-settingsList .colorwaysCreator-preset { - justify-content: start; - gap: 8px; -} - -.colorwaysCreator-settingsList { - overflow: hidden auto; - scrollbar-width: none !important; - max-height: 185px; -} - -.colorwaysCreator-settingCat-collapsed > :is(.colorwaysCreator-settingsList, .colorwayInfo-cssCodeblock), -.colorwaysColorpicker-collapsed { - display: none !important; -} - -.colorwayColorpicker { - display: flex; - flex-direction: column; - padding: 20px 16px !important; - width: 620px !important; - min-height: unset; -} - -.colorwaysCreator-noHeader { - margin-top: 12px; - margin-bottom: 12px; -} - -.colorwaysCreator-noMinHeight { - min-height: unset; - height: fit-content; -} - -.colorwaysPreview-wrapper { - display: flex; - flex-direction: column; - width: 100%; - height: 270px; - flex: 1 0 auto; - border-radius: 4px; - overflow: hidden; -} - -.colorwaysPreview-modal { - max-width: unset !important; - max-height: unset !important; - width: fit-content; - height: fit-content; - pointer-events: all; -} - -.colorwaysPreview-modal > .colorwaysPreview-wrapper { - height: 100%; -} - -.colorwaysPreview-titlebar { - height: 22px; - width: 100%; - display: flex; - flex: 1 0 auto; -} - -.colorwaysPreview-body { - height: 100%; - width: 100%; - display: flex; -} - -.colorwayPreview-guilds { - width: 72px; - height: 100%; - display: flex; - flex: 1 0 auto; - padding-top: 4px; - flex-direction: column; -} - -.colorwayPreview-channels { - width: 140px; - height: 100%; - display: flex; - flex-direction: column-reverse; - border-top-left-radius: 8px; - flex: 1 0 auto; -} - -.colorwaysPreview-wrapper:fullscreen .colorwayPreview-channels { - width: 240px; -} - -.colorwayPreview-chat { - width: 100%; - height: 100%; - display: flex; - position: relative; - flex-direction: column-reverse; -} - -.colorwayPreview-userArea { - width: 100%; - height: 40px; - display: flex; - flex: 1 0 auto; -} - -.colorwaysPreview-wrapper:fullscreen .colorwayPreview-userArea { - height: 52px; -} - -.colorwaysPreview { - display: flex; - flex-direction: column; - padding: 10px; - gap: 5px; - border-radius: 4px; - background-color: var(--background-secondary); - box-sizing: border-box; - color: var(--header-secondary); - overflow: hidden overlay; - margin-bottom: 4px; -} - -.colorwaysPreview-collapsed .colorwaysPreview-wrapper { - display: none; -} - -.colorwayInfo-lastCat, -.colorwaysCreator-lastCat { - margin-bottom: 12px; -} - -.colorwayPreview-guild { - width: 100%; - margin-bottom: 8px; - display: flex; - justify-content: center; -} - -.colorwayPreview-guildItem { - cursor: pointer; - width: 48px; - height: 48px; - border-radius: 50px; - transition: 0.2s ease; - display: flex; - justify-content: center; - align-items: center; -} - -.colorwayPreview-guildItem:hover { - border-radius: 16px; -} - -.colorwayPreview-guildSeparator { - width: 32px; - height: 2px; - opacity: 0.48; - border-radius: 1px; -} - -.colorwayToolbox-listItem { - align-items: center; - border-radius: 4px; - color: var(--interactive-normal); - display: flex; - flex-direction: column; - gap: 12px; - background-color: transparent !important; - width: calc(564px / 4); - cursor: default; - float: left; - box-sizing: border-box; - margin: 0; - padding: 0; -} - -.colorwayToolbox-listItemSVG { - padding: 19px; - overflow: visible; - border-radius: 50%; - background-color: var(--background-tertiary); - border: 1px solid transparent; - display: flex; - justify-content: center; - align-items: center; - transition: 0.15s ease; - cursor: pointer; - color: var(--interactive-normal); -} - -.colorwayToolbox-listItem:hover { - color: var(--interactive-normal) !important; -} - -.colorwayToolbox-listItemSVG:hover { - border-color: var(--brand-500); - background-color: var(--brand-experiment-15a); - color: var(--interactive-hover) !important; -} - -.colorwayToolbox-title { - align-items: center; - display: flex; - text-transform: uppercase; - margin-top: 2px; - padding-bottom: 8px; - margin-bottom: 0; -} - -.colorwayToolbox-list { - box-sizing: border-box; - height: 100%; - display: flex; - flex-direction: column; - gap: 12px; - overflow: hidden; -} - -.colorwayPreview-chatBox { - height: 32px; - border-radius: 6px; - margin: 8px; - margin-bottom: 12px; - margin-top: 0; - flex: 1 1 auto; -} - -.colorwayPreview-filler { - width: 100%; - height: 100%; - flex: 0 1 auto; -} - -.colorwayPreview-topShadow { - box-shadow: - 0 1px 0 hsl(var(--primary-900-hsl) / 20%), - 0 1.5px 0 hsl(var(--primary-860-hsl) / 5%), - 0 2px 0 hsl(var(--primary-900-hsl) / 5%); - width: 100%; - height: 32px; - font-family: var(--font-display); - font-weight: 500; - padding: 12px 16px; - box-sizing: border-box; - align-items: center; - display: flex; - flex: 1 0 auto; -} - -.colorwayPreview-channels > .colorwayPreview-topShadow { - border-top-left-radius: 8px; -} - -.colorwayPreview-channels > .colorwayPreview-topShadow:hover { - background-color: hsl(var(--primary-500-hsl) / 30%); -} - -.colorwaysPreview-wrapper:fullscreen .colorwayPreview-topShadow { - height: 48px; -} - -.colorwaysPreview-wrapper:fullscreen .colorwayPreview-chatBox { - height: 44px; - border-radius: 8px; - margin: 16px; - margin-bottom: 24px; -} - -.colorwaysBtn-tooltipContent { - font-weight: 600; - font-size: 16px; - line-height: 20px; -} - -.colorwaySelector-headerIcon { - box-sizing: border-box; - width: 100%; - height: 100%; - transition: - transform 0.1s ease-out, - opacity 0.1s ease-out; - color: var(--interactive-normal); -} - -.colorwaySelector-header { - align-items: center; - justify-content: center; - padding-bottom: 0; - box-shadow: none !important; -} - -.colorwaySelector-search { - width: 100%; - border-radius: 6px; - background-color: #101010; - transition: 0.2s ease; - border: 1px solid transparent; - padding-left: 12px; - color: #fff; - height: 40px; - box-sizing: border-box; -} - -.colorwaySelector-search:hover { - background-color: #1a1a1a; -} - -.colorwaySelector-search:focus { - background-color: #1a1a1a; - border-color: #a6a6a6; -} - -.colorwaySelector-sources { - flex: 0 0 auto; - color: var(--button-outline-primary-text); - border-color: var(--button-outline-primary-border); -} - -.colorwaySelector-sources:hover { - background-color: var(--button-outline-primary-background-hover); - border-color: var(--button-outline-primary-border-hover); - color: var(--button-outline-primary-text-hover); -} - -.colorwaySelector-headerBtn { - position: absolute; - top: 64px; - right: 20px; -} - -.theme-light .colorwaySelector-pill_selected { - border-color: var(--brand-500) !important; - background-color: var(--brand-experiment-160) !important; -} - -.theme-dark .colorwaySelector-pill_selected { - border-color: var(--brand-500) !important; - background-color: var(--brand-experiment-15a) !important; -} - -.colorwaysTooltip-tooltipPreviewRow { - display: flex; - align-items: center; - margin-top: 8px; -} - -.colorwayCreator-colorPreview { - width: 100%; - border-radius: 4px; - height: 50px; - display: flex; - justify-content: center; - align-items: center; -} - -.colorwaysCreator-colorPreviewItm .colorwayCreator-colorPreviews { - padding: 0; - background-color: transparent; - border-radius: 0; -} - -.colorwaysCreator-colorPreviewItm { - flex-direction: column; - align-items: start; -} - -.colorwaysTooltip-header { - background-color: var(--background-primary); - padding: 2px 8px; - border-radius: 16px; - height: min-content; - color: var(--header-primary); - margin-bottom: 2px; - display: inline-flex; - margin-left: -4px; -} - -.colorwaySelector-pillSeparator { - height: 24px; - width: 1px; - background-color: var(--primary-400); -} - -.colorwaysSelector-changelog { - font-weight: 400; - font-size: 20px; - color: var(--header-secondary); - border-radius: 4px; - background-color: var(--background-secondary); - padding: 8px 12px; -} - -.colorwaysChangelog-li { - position: relative; - font-size: 16px; - line-height: 20px; -} - -.colorwaysChangelog-li::before { - content: ""; - position: absolute; - top: 10px; - left: -15px; - width: 6px; - height: 6px; - margin-top: -4px; - margin-left: -3px; - border-radius: 50%; - opacity: 0.3; -} - -.theme-dark .colorwaysChangelog-li::before { - background-color: hsl(216deg calc(var(--saturation-factor, 1) * 9.8%) 90%); -} - -.theme-light .colorwaysChangelog-li::before { - background-color: hsl(223deg calc(var(--saturation-factor, 1) * 5.8%) 52.9%); -} - -.ColorwaySelectorWrapper .colorwayToolbox-list { - width: 100%; -} - -.colorwaysToolbox-label { - border-radius: 20px; - box-sizing: border-box; - color: var(--text-normal); - transition: 0.15s ease; - width: 100%; - margin-left: 0; - height: fit-content; - text-align: center; - overflow: hidden; - text-overflow: ellipsis; - white-space: wrap; - cursor: default; - max-height: 2rem; - padding: 0 8px; -} - -.colorwaysSelector-changelogHeader { - font-weight: 700; - font-size: 16px; - line-height: 20px; - text-transform: uppercase; - position: relative; - display: flex; - align-items: center; -} - -.colorwaysSelector-changelogHeader::after { - content: ""; - height: 1px; - flex: 1 1 auto; - margin-left: 4px; - opacity: 0.6; - background-color: currentcolor; -} - -.colorwaysSelector-changelogHeader_added { - color: var(--text-positive); -} - -.colorwaysSelector-changelogHeader_fixed { - color: hsl(359deg calc(var(--saturation-factor, 1) * 87.3%) 59.8%); -} - -.colorwaysSelector-changelogHeader_changed { - color: var(--text-warning); -} - -.is-mobile .colorwaySelectorModal, -.is-mobile .colorwayCreator-modal { - width: 100vw !important; - box-sizing: border-box; - min-width: unset; - border-radius: 0; - height: 100vh; - max-height: unset; - border: none; -} - -.is-mobile .colorwaySelectorModalContent { - box-sizing: border-box; - width: 100vw; -} - -.is-mobile .colorwaySelector-doublePillBar { - flex-direction: column-reverse; - align-items: end; -} - -.is-mobile .colorwaySelector-doublePillBar > .colorwaySelector-pillWrapper:first-child { - width: 100%; - gap: 4px; - overflow-x: auto; - justify-content: space-between; -} - -.is-mobile .colorwaySelector-doublePillBar > .colorwaySelector-pillWrapper:first-child > .colorwaySelector-pill { - border-radius: 0; - border-top: none; - border-left: none; - border-right: none; - background-color: transparent; - width: 100%; - justify-content: center; - flex: 0 0 min-content; -} - -.is-mobile - .colorwaySelector-doublePillBar - > .colorwaySelector-pillWrapper:first-child - > .colorwaySelector-pillSeparator { - display: none; -} - -.is-mobile .layer-fP3xEz:has(.colorwaySelectorModal, .colorwayCreator-modal) { - padding: 0; -} - -.is-mobile .ColorwaySelectorWrapper { - justify-content: space-around; - gap: 10px; -} - -#colorwaySelector-pill_closeSelector { - display: none !important; -} - -.is-mobile #colorwaySelector-pill_closeSelector { - display: flex !important; -} - -.colorwaysBtn-spinner { - display: flex; - justify-content: center; - align-items: center; - width: 100%; -} - -.colorwaysBtn-spinnerInner { - transform: rotate(280deg); - position: relative; - display: inline-block; - width: 32px; - height: 32px; - contain: paint; -} - -@keyframes spinner-spinning-circle-rotate { - 100% { - transform: rotate(1turn); - } -} - -@keyframes spinner-spinning-circle-dash { - 0% { - stroke-dasharray: 1, 200; - stroke-dashoffset: 0; - } - - 50% { - stroke-dasharray: 130, 200; - } - - 100% { - stroke-dasharray: 130, 200; - stroke-dashoffset: -124; - } -} - -.colorwaysBtn-spinnerCircular { - animation: spinner-spinning-circle-rotate 2s linear infinite; - height: 100%; - width: 100%; -} - -.colorwaysBtn-spinnerBeam { - animation: spinner-spinning-circle-dash 2s ease-in-out infinite; - stroke-dasharray: 1, 200; - stroke-dashoffset: 0; - fill: none; - stroke-width: 6; - stroke-miterlimit: 10; - stroke-linecap: round; - stroke: currentcolor; -} - -.colorwaysBtn-spinnerBeam2 { - stroke: currentcolor; - opacity: 0.6; - animation-delay: 0.15s; -} - -.colorwaysBtn-spinnerBeam3 { - stroke: currentcolor; - opacity: 0.3; - animation-delay: 0.23s; -} - -.colorwaysModalTab { - padding: 16px; -} - -.colorwaysSettings-colorwaySource { - display: flex; - flex-direction: row; - justify-content: space-between; - padding: 8px; - gap: 5px; - border-radius: 8px; - box-sizing: border-box; - align-items: center; - background-color: #101010; -} - -.discordColorway { - display: flex; - flex-direction: row; - justify-content: start; - padding: 0 8px; - gap: 5px; - border-radius: 6px; - background-color: #101010; - box-sizing: border-box; - min-height: 44px; - align-items: center; - border: 1px solid transparent; - transition: 0.2s ease; - cursor: pointer; -} - -.discordColorway:hover { - background-color: #2a2a2a; - filter: brightness(0.8); -} - -.discordColorway[aria-checked="true"] { - background-color: #2a2a2a; - border-color: #a6a6a6; -} - -.colorwaysSettings-modalRoot { - min-width: 520px; -} - -.colorwaysSettings-colorwaySourceLabel { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - flex-grow: 1; - line-height: 30px; -} - -.colorwaysSettings-colorwaySourceLabelHeader { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - flex-grow: 1; - font-weight: 700; - font-size: 16px; -} - -.colorwaysModalSectionHeader, -.colorwaysSettings-colorwaySourceLabel, -.colorwaysSettings-colorwaySourceLabelHeader, -.colorwaysSettings-colorwaySourceDesc { - color: #fff; -} - -.colorwaysSettings-colorwaySourceDesc { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - flex-grow: 1; -} - -.colorwaysSettings-iconButton { - background-color: transparent !important; - border-radius: 0; -} - -.colorwaysSettings-iconButtonInner { - display: flex; - gap: 4px; - align-items: center; -} - -.colorwaysSettings-modalContent { - margin: 8px 0; -} - -@keyframes loading-bar { - 0% { - left: 0; - right: 100%; - width: 0; - } - - 10% { - left: 0; - right: 75%; - width: 25%; - } - - 90% { - right: 0; - left: 75%; - width: 25%; - } - - 100% { - left: 100%; - right: 0; - width: 0; - } -} - -.colorwaysLoader-barContainer { - width: 100%; - border-radius: var(--radius-round); - border: 0; - position: relative; - padding: 0; -} - -.colorwaysLoader-bar { - position: absolute; - border-radius: var(--radius-round); - top: 0; - right: 100%; - bottom: 0; - left: 0; - background: var(--brand-500); - width: 0; - animation: loading-bar 2s linear infinite; - transition: 0.2s ease; -} - -.colorwaysSettingsSelector-wrapper { - display: flex; - flex-direction: column; - gap: 8px; -} - -.colorwaysSettingsPage-wrapper .colorwayToolbox-listItem { - gap: 8px; - border-radius: 50px; - padding: 12px 16px; - background-color: var(--background-tertiary); - transition: 0.15s ease; - border: 1px solid transparent; - color: var(--interactive-normal); -} - -.colorwaysSettingsPage-wrapper .colorwayToolbox-listItem:hover { - border-color: var(--brand-500); - background-color: var(--brand-experiment-15a); - color: var(--interactive-hover); -} - -.colorwaysSettingsSelector-wrapper .colorwaySelector-doublePillBar { - justify-content: start; -} - -.colorwaysCreator-toolboxItm:hover { - background-color: var(--brand-experiment) !important; -} - -.colorwayCreator-colorPreview_primary + .colorwayCreator-colorPreview_primary, -.colorwayCreator-colorPreview_secondary + .colorwayCreator-colorPreview_secondary, -.colorwayCreator-colorPreview_tertiary + .colorwayCreator-colorPreview_tertiary, -.colorwayCreator-colorPreview_accent + .colorwayCreator-colorPreview_accent { - display: none; -} - -.colorwaysConflictingColors-warning { - width: 100%; - text-align: center; - justify-content: center; - color: #fff; -} - -.ColorwaySelectorBtn_thin { - height: 21px !important; - width: 56px !important; -} - -.ColorwaySelectorBtn_thin:hover { - border-radius: 8px; -} - -.colorwaySelector-searchPopout { - display: none !important; -} - -.colorways-badge { - font-size: 0.625rem; - text-transform: uppercase; - vertical-align: top; - display: inline-flex; - align-items: center; - text-indent: 0; - background: #fff; - color: #000; - flex: 0 0 auto; - height: 15px; - padding: 0 4px; - margin-top: 7.5px; - border-radius: 16px; -} - -.hoverRoll { - display: inline-block; - vertical-align: top; - cursor: default; - text-align: left; - box-sizing: border-box; - position: relative; - width: 100%; - contain: paint; -} - -.hoverRoll_hovered { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - display: block; - transition: all.22s ease; - transform-style: preserve-3d; - pointer-events: none; - width: 100%; - opacity: 0; - transform: translate3d(0, 107%, 0); - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; -} - -.hoverRoll:hover .hoverRoll_hovered, -.colorwaysSettings-colorwaySource:hover .hoverRoll_hovered { - transform: translateZ(0); - opacity: 1; -} - -.hoverRoll_normal { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - display: block; - transition: all 0.22s ease; - transform-style: preserve-3d; - pointer-events: none; - width: 100%; -} - -.hoverRoll:hover .hoverRoll_normal, -.colorwaysSettings-colorwaySource:hover .hoverRoll_normal { - transform: translate3d(0, -107%, 0); - opacity: 0; - user-select: none; -} - -.dc-warning-card { - padding: 1em; - margin-bottom: 1em; - background-color: var(--info-warning-background); - border-color: var(--info-warning-foreground); - color: var(--info-warning-text); -} - -/* stylelint-disable-next-line no-duplicate-selectors */ -.colorwaysPreview-modal { - width: 90vw !important; - height: 90vh !important; - max-height: unset !important; - animation: show-modal 0.2s ease; -} - -.colorwaysPresetPicker-content { - padding: 16px; -} - -.colorwaysPresetPicker { - width: 600px; -} - -.colorwaysCreator-setting { - display: flex; - flex-direction: row; - justify-content: space-between; - border-radius: 8px; - background-color: #1a1a1a; - box-sizing: border-box; - padding: 10px 18px; - padding-right: 10px; - cursor: pointer; - align-items: center; -} - -.colorwaysCreator-setting:hover { - background-color: #2a2a2a; -} - -.dc-colorway-selector::before { - /* stylelint-disable-next-line property-no-vendor-prefix */ - -webkit-mask: var(--si-appearance) center/contain no-repeat !important; - mask: var(--si-appearance) center/contain no-repeat !important; -} - -.dc-colorway-settings::before { - /* stylelint-disable-next-line property-no-vendor-prefix */ - -webkit-mask: var(--si-equicordsettings) center/contain no-repeat !important; - mask: var(--si-equicordsettings) center/contain no-repeat !important; -} - -.dc-colorway-ondemand::before { - /* stylelint-disable-next-line property-no-vendor-prefix */ - -webkit-mask: var(--si-equicordupdater) center/contain no-repeat !important; - mask: var(--si-equicordupdater) center/contain no-repeat !important; -} - -.dc-colorway-sources-manager::before { - /* stylelint-disable-next-line property-no-vendor-prefix */ - -webkit-mask: var(--si-instantinvites) center/contain no-repeat !important; - mask: var(--si-instantinvites) center/contain no-repeat !important; -} - -.colorwaySourceModal { - min-height: unset; -} - -.colorwaySelector-sourceSelect { - width: fit-content !important; -} - -.dc-info-card { - border-radius: 5px; - border: 1px solid var(--blue-345); - padding: 1em; - margin-bottom: 1em; - display: flex; - gap: 1em; - flex-direction: column; -} - -.theme-dark .dc-info-card { - color: var(--white-500); -} - -.theme-light .dc-info-card { - color: var(--black-500); -} - -.colorwaysSettings-sourceScroller { - scrollbar-width: none; - display: flex; - flex-direction: column; - gap: 8px; - overflow: hidden auto; -} - -.colorwaysScroller { - scrollbar-width: none !important; - overflow: hidden auto; -} - -.colorwaysSettings-sourceScroller::-webkit-scrollbar { - width: 0; -} - -.colorwayMessage { - padding: 20px; - border: 1px solid #a6a6a6f0; - border-radius: 8px; - background-color: #090909; - display: flex; -} - -.colorwayMessage-contents { - display: flex; - flex-direction: column; -} - -.colorwaysLoadingModal, -.colorwayInfo-cssModal { - width: fit-content; - height: fit-content; - min-width: unset; - min-height: unset; - background: none; - box-shadow: none !important; - border: none; -} - -.discordColorway .discordColorwayPreviewColorContainer { - width: 30px; - height: 30px; -} - -.discordColorway .colorwayInfoIconContainer { - height: 28px; - width: 28px; - border-radius: 3px; - position: static; - opacity: 1; - justify-content: center; - display: flex; - align-items: center; - background: transparent; - border: 1px solid var(--button-outline-primary-border); - color: var(--button-outline-primary-text); - transition: 0.15s; -} - -.discordColorway .colorwayInfoIconContainer:hover { - background-color: var(--button-outline-primary-background-hover); - border-color: var(--button-outline-primary-border-hover); - color: var(--button-outline-primary-text-hover); -} - -.colorwayLabel { - margin-right: auto; - margin-top: 0 !important; - margin-left: 0.5rem; - color: #dfdfdf; -} - -.colorwaySelectionCircle { - position: absolute; - width: 56px; - height: 56px; - top: 0; - left: 0; -} - -.colorwaySelector-sorter { - height: 50px; - width: 100%; - box-shadow: var(--elevation-low); - margin-bottom: 8px; - display: flex; -} - -.colorwaySelector-sorter_selectedSpacer { - width: 80px; - height: 50px; -} - -.colorwaySelector-sorter_text { - line-height: 50px; - margin: 0; -} - -.colorwaySelector-sorter_name { - margin-right: auto; - cursor: pointer; -} - -.colorwayPresetLabel { - margin-right: 1rem; -} - -.colorwayPreview-channel { - margin: 10px; - width: calc(100% - 20px); - height: 8px; - border-radius: 16px; -} - -.colorwaysModal { - border-radius: 16px; - background-color: #000; - color: #fff; - height: fit-content; - min-height: unset; - width: fit-content; - border: none; - padding: 0; - margin: 0; - transition: 0.4s ease; - animation: show-modal 0.4s ease; - pointer-events: all; -} - -.colorwaysModalContent { - display: flex; - flex-direction: column; - gap: 4px; - padding: 16px; -} - -.colorwaysModalContent-sourcePreview { - padding-left: 0; - padding-right: 0; -} - -.colorwaysMenuTabs { - width: 100%; - height: 30px; - padding-bottom: 8px; - box-sizing: content-box; -} - -.colorwaysMenuTab { - color: #fff; - text-decoration: none; - padding: 4px 12px; - border-radius: 32px; - transition: 0.2s ease; - margin-right: 8px; - display: inline-block; -} - -.colorwaySourceTab { - box-sizing: border-box; - width: 100%; - display: flex; - flex-direction: column; - gap: 8px; -} - -.colorwaysMenuTab:hover { - background-color: #1f1f1f; -} - -.colorwaysMenuTab.active { - color: #000; - background-color: #fff; -} - -.colorwaysModalFooter { - border-top-left-radius: 8px; - border-top-right-radius: 8px; - border-bottom-left-radius: 16px; - border-bottom-right-radius: 16px; - padding: 8px; - display: flex; - flex-direction: row-reverse; - background-color: #0a0a0a; - width: calc(100% - 16px); - gap: 8px; -} - -.colorwaysModalFooter > .colorwaysPillButton { - width: 100%; -} - -.colorwaysModalHeader { - margin: 0; - font-weight: normal; - font-size: 1.25em; - padding: 16px; -} - -.colorwaysModalSectionHeader { - font-size: 14px; - margin-bottom: 2px; -} - -.colorwaysModalSectionError { - color: red; - font-style: italic; -} - -.colorwayIDCard { - display: flex; - flex-direction: column; - gap: 1em; -} - -.colorwaysContextMenu { - border-radius: 8px; - border: 1px solid #dfdfdf; - background-color: #000; - padding: 4px; - display: flex; - flex-direction: column; - gap: 4px; - z-index: 5; -} - -.colorwaysContextMenuItm { - box-sizing: border-box; - display: flex; - justify-content: space-between; - align-items: center; - min-height: 32px; - padding: 6px 8px; - border-radius: 6px; - background-color: #101010; - border: 1px solid transparent; - transition: 0.2s ease; - cursor: pointer; - color: #dfdfdf; -} - -.colorwaysContextMenuItm:hover { - background-color: #2a2a2a; - border-color: #a6a6a6; -} - -.colorwaysRadioSelected { - fill: #fff; -} - -.colorwaysTooltip { - background-color: var(--background-floating); - box-shadow: var(--shadow-high); - color: var(--text-normal); - pointer-events: none; - border-radius: 5px; - font-weight: 500; - font-size: 14px; - line-height: 16px; - max-width: 190px; - box-sizing: border-box; - word-wrap: break-word; - z-index: 1002; - will-change: opacity, transform; - transition: - transform 0.1s ease, - opacity 0.1s ease; - position: fixed; -} - -.colorwaysTooltip.colorwaysTooltip-hidden { - transform: scale(0.95); - opacity: 0; -} - -.colorwaysTooltip-right { - transform-origin: 0% 50%; -} - -.colorwaysTooltipPointer { - width: 0; - height: 0; - border: 0 solid transparent; - border-width: 5px; - pointer-events: none; - border-top-color: var(--background-floating); -} - -.colorwaysTooltip-right > .colorwaysTooltipPointer { - position: absolute; - right: 100%; - top: 50%; - margin-top: -5px; - border-left-width: 5px; - transform: rotate(90deg); -} - -.colorwaysTooltipContent { - padding: 8px 12px; - overflow: hidden; - font-weight: 600; - font-size: 16px; - line-height: 20px; - display: flex; - flex-direction: column; -} - -.colorwaysManagerConnectionMenu { - transform: translateX(-20px); - opacity: 0; - border: 1px solid #a6a6a6f0; - background-color: #090909; - transition: - transform 0.2s ease, - opacity 0.2s ease; - display: flex; - flex-direction: column; - padding: 8px 12px; - color: #fff; - pointer-events: none; - border-radius: 8px; - font-weight: 600; - font-size: 16px; - line-height: 20px; -} - -.colorwaysManagerConnectionMenu.visible { - opacity: 1; - transform: none; - pointer-events: all; -} - -.colorwaysManagerConnectionValue { - color: #80868e; - font-weight: 500; - font-size: 12; -} - -.colorwaysManagerConnectionValue > b { - color: #a0a6ae; -} diff --git a/src/equicordplugins/discordColorways/theme.discord.css b/src/equicordplugins/discordColorways/theme.discord.css deleted file mode 100644 index 6c7cdb65..00000000 --- a/src/equicordplugins/discordColorways/theme.discord.css +++ /dev/null @@ -1,334 +0,0 @@ -/* stylelint-disable property-no-vendor-prefix */ -.colorwaySelectorModal[data-theme="discord"], -.colorwayModal[data-theme="discord"] { - border: none; - box-shadow: var(--legacy-elevation-border), var(--legacy-elevation-high); - background-color: var(--modal-background); -} - -[data-theme="discord"] .colorwaysSettingsDivider { - border-color: var(--background-modifier-accent); -} - -[data-theme="discord"] .colorwaySwitch-label, -[data-theme="discord"] .colorwaysNote { - color: var(--header-primary); -} - -[data-theme="discord"] .colorwaysSettings-switchCircle { - fill: #fff !important; -} - -[data-theme="discord"] .colorwaysSettings-switch { - background-color: rgb(128 132 142); -} - -[data-theme="discord"] .colorwaysSettings-switch.checked { - background-color: #23a55a; -} - -[data-theme="discord"] > .colorwaySelectorSidebar > .colorwaySelectorSidebar-tab { - transition: none; - border-radius: 4px; - border: none; -} - -[data-theme="discord"] > .colorwaySelectorSidebar > .colorwaySelectorSidebar-tab.active { - background-color: var(--background-modifier-selected); -} - -[data-theme="discord"] > .colorwaySelectorSidebar > .colorwaySelectorSidebar-tab:hover { - background-color: var(--background-modifier-hover); -} - -[data-theme="discord"] .colorwaysPillButton { - color: var(--white-500); - background-color: var(--button-secondary-background); - height: var(--custom-button-button-sm-height); - min-width: var(--custom-button-button-sm-width); - min-height: var(--custom-button-button-sm-height); - width: auto; - transition: - background-color var(--custom-button-transition-duration) ease, - color var(--custom-button-transition-duration) ease; - position: relative; - display: flex; - justify-content: center; - align-items: center; - box-sizing: border-box; - border: none; - border-radius: 3px; - font-size: 14px; - font-weight: 500; - line-height: 16px; - padding: 2px 16px; - -moz-user-select: none; - user-select: none; -} - -[data-theme="discord"] .colorwaysPillButton:hover { - background-color: var(--button-secondary-background-hover); -} - -[data-theme="discord"] > .colorwaySelectorSidebar { - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; - background-color: var(--modal-footer-background); - box-shadow: inset 0 1px 0 hsl(var(--primary-630-hsl) / 60%); - padding: 12px; -} - -[data-theme="discord"] .colorwaySelector-search { - border-radius: 3px; - color: var(--text-normal); - background-color: var(--input-background) !important; - height: 40px; - padding: 10px; - transition: none; - font-size: 16px; - border: none; -} - -[data-theme="discord"] .colorwaysSettings-colorwaySource { - border-radius: 4px; - color: var(--interactive-normal); - background-color: var(--background-secondary); -} - -[data-theme="discord"] .colorwaysSettings-colorwaySource:hover { - color: var(--interactive-active); - background-color: var(--background-modifier-hover); -} - -[data-theme="discord"] .discordColorway { - border-radius: 4px; - transition: none; - background-color: var(--background-secondary); - border: none; -} - -[data-theme="discord"] .discordColorway:hover { - filter: none; - background-color: var(--background-modifier-hover); -} - -[data-theme="discord"] .discordColorway[aria-checked="true"] { - background-color: var(--background-modifier-selected); -} - -[data-theme="discord"] .colorwaysSettings-colorwaySourceLabelHeader, -[data-theme="discord"] .colorwaysSettings-colorwaySourceDesc { - color: var(--header-primary); -} - -[data-theme="discord"] .colorways-badge { - height: 16px; - padding: 0 4px; - border-radius: 4px; - margin-left: 4px; - flex: 0 0 auto; - background: var(--bg-brand); - color: var(--white); - text-transform: uppercase; - vertical-align: top; - display: inline-flex; - align-items: center; - text-indent: 0; - font-weight: 600; - font-size: 0.625rem; - line-height: 16px; -} - -.colorwaysModal[data-theme="discord"] { - box-shadow: var(--legacy-elevation-border), var(--legacy-elevation-high); - background-color: var(--modal-background); - border-radius: 4px; - display: flex; - flex-direction: column; - margin: 0 auto; - pointer-events: all; - position: relative; -} - -[data-theme="discord"] .colorwaysMenuTabs { - padding-bottom: 16px; -} - -[data-theme="discord"] .colorwaysMenuTab { - padding: 0; - padding-bottom: 16px; - margin-right: 32px; - margin-bottom: -2px; - border-bottom: 2px solid transparent; - transition: none; - border-radius: 0; - background-color: transparent; - font-size: 16px; - line-height: 20px; - cursor: pointer; - font-weight: 500; -} - -[data-theme="discord"] .colorwaysMenuTab:hover { - color: var(--interactive-hover); - border-bottom-color: var(--brand-500); -} - -[data-theme="discord"] .colorwaysMenuTab.active { - cursor: default; - color: var(--interactive-active); - border-bottom-color: var(--control-brand-foreground); -} - -[data-theme="discord"] .colorwaysModalFooter { - border-radius: 0 0 5px 5px; - background-color: var(--modal-footer-background); - padding: 16px; - box-shadow: inset 0 1px 0 hsl(var(--primary-630-hsl) / 60%); - gap: 0; - width: unset; -} - -[data-theme="discord"] .colorwaysModalFooter > .colorwaysPillButton { - width: auto; - height: var(--custom-button-button-md-height); - min-width: var(--custom-button-button-md-width); - min-height: var(--custom-button-button-md-height); - transition: - color var(--custom-button-transition-duration) ease, - background-color var(--custom-button-transition-duration) ease, - border-color var(--custom-button-transition-duration) ease; - border: 1px solid var(--button-outline-primary-border); - color: var(--button-outline-primary-text); - margin-left: 8px; - background-color: transparent; -} - -[data-theme="discord"] .colorwaysModalFooter > .colorwaysPillButton:hover { - background-color: var(--button-outline-primary-background-hover); - border-color: var(--button-outline-primary-border-hover); - color: var(--button-outline-primary-text-hover); -} - -[data-theme="discord"] .colorwaysModalFooter > .colorwaysPillButton:active { - background-color: var(--button-outline-primary-background-active); - border-color: var(--button-outline-primary-border-active); - color: var(--button-outline-primary-text-active); -} - -[data-theme="discord"] .colorwaysModalFooter > .colorwaysPillButton.colorwaysPillButton-onSurface { - color: var(--white-500); - background-color: var(--brand-500); - border: none; -} - -[data-theme="discord"] .colorwaysModalFooter > .colorwaysPillButton.colorwaysPillButton-onSurface:hover { - background-color: var(--brand-560); -} - -[data-theme="discord"] .colorwaysModalFooter > .colorwaysPillButton.colorwaysPillButton-onSurface:active { - background-color: var(--brand-600); -} - -[data-theme="discord"] .colorwaysModalHeader { - box-shadow: - 0 1px 0 0 hsl(var(--primary-800-hsl) / 30%), - 0 1px 2px 0 hsl(var(--primary-800-hsl) / 30%); - border-radius: 4px 4px 0 0; - transition: box-shadow 0.1s ease-out; - word-wrap: break-word; -} - -[data-theme="discord"] .colorwaysModalSectionHeader, -[data-theme="discord"] .colorwaysSettings-colorwaySourceLabel, -[data-theme="discord"] .colorwaysSettings-colorwaySourceLabelHeader, -[data-theme="discord"] .colorwaysSettings-colorwaySourceDesc { - color: var(--header-primary); -} - -[data-theme="discord"] .colorwaysCreator-setting, -[data-theme="discord"] .colorwaysCreator-settingCat { - border-radius: 4px; - background-color: var(--background-secondary); -} - -[data-theme="discord"] .colorwaysCreator-setting:hover { - background-color: var(--background-modifier-hover); -} - -[data-theme="discord"] .colorwaysContextMenu { - background: var(--background-floating); - box-shadow: var(--shadow-high); - border-radius: 4px; - padding: 6px 8px; - border: none; - gap: 0; - min-width: 188px; - max-width: 320px; - box-sizing: border-box; -} - -[data-theme="discord"] .colorwaysContextMenuItm { - border: none; - transition: none; - margin: 2px 0; - border-radius: 2px; - font-size: 14px; - font-weight: 500; - line-height: 18px; - color: var(--interactive-normal); - background-color: transparent; -} - -[data-theme="discord"] .colorwaysContextMenuItm:hover { - background-color: var(--menu-item-default-hover-bg); - color: var(--white); -} - -[data-theme="discord"] .colorwaysContextMenuItm:active { - background-color: var(--menu-item-default-active-bg); - color: var(--white); -} - -[data-theme="discord"] .colorwaysRadioSelected { - fill: var(--control-brand-foreground-new); -} - -[data-theme="discord"] .colorwaysConflictingColors-warning { - color: var(--text-normal); -} - -[data-theme="discord"] .colorwaysManagerConnectionMenu { - transition: - transform 0.1s ease, - opacity 0.1s ease; - transform: scale(0.95); - transform-origin: 0% 50%; - background-color: var(--background-floating); - box-shadow: var(--shadow-high); - color: var(--text-normal); - border: none; - border-radius: 5px; -} - -.colorwayIDCard[data-theme="discord"] > .colorwayMessage { - border-radius: 5px; - border: none; - background-color: var(--background-secondary); -} - -.theme-dark .colorwayIDCard[data-theme="discord"] .colorwayMessage { - background: hsl(var(--primary-630-hsl) / 60%); -} - -.theme-light .colorwayIDCard[data-theme="discord"] .colorwayMessage { - background: hsl(var(--primary-100-hsl) / 60%); -} - -[data-theme="discord"] .colorwaysManagerConnectionValue { - color: var(--text-muted); -} - -[data-theme="discord"] .colorwaysManagerConnectionValue > b { - color: var(--text-normal); -} diff --git a/src/equicordplugins/discordColorways/types.ts b/src/equicordplugins/discordColorways/types.ts deleted file mode 100644 index 0678e31f..00000000 --- a/src/equicordplugins/discordColorways/types.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -export interface Colorway { - [key: string]: any, - name: string, - "dc-import": string, - accent: string, - primary: string, - secondary: string, - tertiary: string, - original?: boolean, - author: string, - authorID: string, - colors?: string[], - isGradient?: boolean, - sourceType?: "online" | "offline" | "temporary" | null, - source?: string, - linearGradient?: string, - preset?: string, - creatorVersion: string, - colorObj?: { accent?: string, primary?: string, secondary?: string, tertiary?: string; }; -} - -export interface ColorPickerProps { - color: number; - showEyeDropper: boolean; - suggestedColors: string[]; - label: any; - onChange(color: number): void; -} - -export interface ColorwayObject { - id: string | null, - css?: string | null, - sourceType: "online" | "offline" | "temporary" | null, - source: string | null | undefined, - colors?: { - accent?: string | undefined, - primary?: string | undefined, - secondary?: string | undefined, - tertiary?: string | undefined; - } | undefined; -} - -export interface SourceObject { - type: "online" | "offline" | "temporary", - source: string, - colorways: Colorway[]; -} - -export enum SortOptions { - NAME_AZ = 1, - NAME_ZA = 2, - SOURCE_AZ = 3, - SOURCE_ZA = 4 -} - -export interface StoreObject { - sources: StoreItem[]; -} - -export interface StoreItem { - name: string, - id: string, - description: string, - url: string, - authorGh: string; -} - -export interface ModalProps { - transitionState: 0 | 1 | 2 | 3 | 4; - onClose(): void; -} diff --git a/src/equicordplugins/discordColorways/utils.ts b/src/equicordplugins/discordColorways/utils.ts deleted file mode 100644 index 869f82e4..00000000 --- a/src/equicordplugins/discordColorways/utils.ts +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -export function HexToHSL(H: string) { - let r: any = 0, g: any = 0, b: any = 0; - if (H.length === 4) r = "0x" + H[1] + H[1], g = "0x" + H[2] + H[2], b = "0x" + H[3] + H[3]; - else if (H.length === 7) { - r = "0x" + H[1] + H[2]; - g = "0x" + H[3] + H[4]; - b = "0x" + H[5] + H[6]; - } - r /= 255, g /= 255, b /= 255; - var cmin = Math.min(r, g, b), - cmax = Math.max(r, g, b), - delta = cmax - cmin, - h = 0, - s = 0, - l = 0; - if (delta === 0) h = 0; - else if (cmax === r) h = ((g - b) / delta) % 6; - else if (cmax === g) h = (b - r) / delta + 2; - else h = (r - g) / delta + 4; - h = Math.round(h * 60); - if (h < 0) h += 360; - l = (cmax + cmin) / 2; - s = delta === 0 - ? 0 - : delta / (1 - Math.abs(2 * l - 1)); - s = +(s * 100).toFixed(1); - l = +(l * 100).toFixed(1); - - return [Math.round(h), Math.round(s), Math.round(l)]; -} - -export const canonicalizeHex = (hex: string) => { - const canvas = document.createElement("canvas"); - const ctx = canvas.getContext("2d")!; - - ctx.fillStyle = hex; - hex = ctx.fillStyle; - canvas.remove(); - - return hex; -}; - -export const stringToHex = (str: string) => { - let hex = ""; - for ( - let i = 0; - i < str.length; - i++ - ) { - const charCode = str.charCodeAt(i); - const hexValue = charCode.toString(16); - hex += hexValue.padStart(2, "0"); - } - return hex; -}; - -export const hexToString = (hex: string) => { - let str = ""; - for (let i = 0; i < hex.length; i += 2) { - const hexValue = hex.substr(i, 2); - const decimalValue = parseInt(hexValue, 16); - str += String.fromCharCode(decimalValue); - } - return str; -}; - -export function getHex(str: string): string { - const color = Object.assign( - document.createElement("canvas").getContext("2d") as {}, - { fillStyle: str } - ).fillStyle; - if (color.includes("rgba(")) { - return getHex(String([...color.split(",").slice(0, 3), ")"]).replace(",)", ")").replace("a", "")); - } else { - return color; - } -} - -export function getFontOnBg(bgColor: string) { - var color = (bgColor.charAt(0) === "#") ? bgColor.substring(1, 7) : bgColor; - var r = parseInt(color.substring(0, 2), 16); - var g = parseInt(color.substring(2, 4), 16); - var b = parseInt(color.substring(4, 6), 16); - return (((r * 0.299) + (g * 0.587) + (b * 0.114)) > 186) ? - "#000000" : "#ffffff"; -} - -export function $e(funcArray: Array<(...vars: any) => void>, ...vars: any[]) { - funcArray.forEach(e => e(vars)); -} - -export function hslToHex(h: number, s: number, l: number) { - h /= 360; - s /= 100; - l /= 100; - let r: any, g: any, b: any; - if (s === 0) { - r = g = b = l; // achromatic - } else { - const hue2rgb = (p: number, q: number, t: number) => { - if (t < 0) t += 1; - if (t > 1) t -= 1; - if (t < 1 / 6) return p + (q - p) * 6 * t; - if (t < 1 / 2) return q; - if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; - return p; - }; - const q = l < 0.5 ? l * (1 + s) : l + s - l * s; - const p = 2 * l - q; - r = hue2rgb(p, q, h + 1 / 3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1 / 3); - } - const toHex = (x: number) => { - const hex = Math.round(x * 255).toString(16); - return hex.length === 1 ? "0" + hex : hex; - }; - return `#${toHex(r)}${toHex(g)}${toHex(b)}`; -} - -export function rgbToHex(r: number, g: number, b: number) { - const toHex = (x: number) => { - const hex = Math.round(x * 255).toString(16); - return hex.length === 1 ? "0" + hex : hex; - }; - return `#${toHex(r)}${toHex(g)}${toHex(b)}`; -} - -export function colorToHex(color: string) { - var colorType = "hex"; - if (color.includes("hsl")) { - colorType = "hsl"; - } else if (color.includes("rgb")) { - colorType = "rgb"; - } - color = color.replaceAll(",", "").replace(/.+?\(/, "").replace(")", "").replaceAll(/[ \t]+\/[ \t]+/g, " ").replaceAll("%", "").replaceAll("/", ""); - if (colorType === "hsl") { - color = hslToHex(Number(color.split(" ")[0]), Number(color.split(" ")[1]), Number(color.split(" ")[2])); - } - if (colorType === "rgb") { - color = rgbToHex(Number(color.split(" ")[0]), Number(color.split(" ")[1]), Number(color.split(" ")[2])); - } - return color.replace("#", ""); -} - -export const parseClr = (clr: number) => (clr & 0x00ffffff).toString(16).padStart(6, "0"); - -export async function getRepainterTheme(link: string): Promise<{ status: "success" | "fail", id?: string, colors?: string[], errorCode?: number, errorMsg?: string; }> { - const linkCheck: string | undefined = link.match(/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_+.~#?&//=]*)/g)!.filter(x => x.startsWith("https://repainter.app/themes/"))[0]; - - if (!linkCheck) return { status: "fail", errorCode: 0, errorMsg: "Invalid URL" }; - - // const res = await ( - // await fetch( - // `https://repainter.app/_next/data/Z0BCpVYZyrdkss0k0zqLC/themes/${link.match(/themes\/([a-z0-9]+)/i)?.[1] ?? "" - // }.json`, - // { - // "headers": { - // "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", - // "accept-language": "en-US,en;q=0.9", - // "if-none-match": "W/\"4b2-Wsw1gFTK1l04ijqMn5s6ZUnH6hM\"", - // "priority": "u=0, i", - // "sec-ch-ua": "\"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"", - // "sec-ch-ua-mobile": "?0", - // "sec-ch-ua-platform": "\"Linux\"", - // "sec-fetch-dest": "document", - // "sec-fetch-mode": "navigate", - // "sec-fetch-site": "none", - // "sec-fetch-user": "?1", - // "upgrade-insecure-requests": "1" - // }, - // "referrerPolicy": "strict-origin-when-cross-origin", - // "body": null, - // "method": "GET", - // "mode": "cors", - // "credentials": "omit", - // "cache": "no-store" - // }, - // ) - // ); - const { pageProps: { fallback: { a: { name, colors } } } } = { "pageProps": { "initialId": "01G5PMR5G9H76H1R2RET4A0ZHY", "fallback": { a: { "id": "01G5PMR5G9H76H1R2RET4A0ZHY", "name": "Midwinter Fire", "description": "Very red", "createdAt": "2022-06-16T16:15:11.881Z", "updatedAt": "2022-07-12T08:37:13.141Z", "settingsLines": ["Colorful", "Bright", "Vibrant style"], "voteCount": 309, "colors": [-1426063361, 4294901760, 4294901760, -1426071591, -1426080078, -1426089335, 4294901760, -1426119398, -1428615936, -1431629312, -1434644480, 4294901760, 4294901760, 4294901760, 4294901760, -1426067223, -1426071086, -1426079070, -1426088082, 4294901760, -1428201216, -1430761216, -1433255936, 4294901760, 4294901760, 4294901760, 4294901760, 4294901760, 4294901760, -1426070330, 4294901760, -1426086346, 4294901760, -1430030080, 4294901760, -1434431744, 4294901760, 4294901760, 4294901760, 4294901760, -1426064133, 4294901760, -1426071591, 4294901760, -1426874223, 4294901760, -1430359452, 4294901760, -1433845194, 4294901760, -1437922816, 4294901760, 4294901760, 4294901760, 4294901760, -1426071591, -1426080078, -1426089335, -1427799438, -1429640356, 4294901760, -1433191891, 4294901760, 4294901760, 4294901760] } } }, "__N_SSP": true } as any; - return { status: "success", id: name, colors: colors.filter(c => c !== 4294901760).map(c => "#" + parseClr(c)) }; -} - -/** - * Prompts the user to choose a file from their system - * @param mimeTypes A comma separated list of mime types to accept, see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept#unique_file_type_specifiers - * @returns A promise that resolves to the chosen file or null if the user cancels - */ -export function chooseFile(mimeTypes: string) { - return new Promise(resolve => { - const input = document.createElement("input"); - input.type = "file"; - input.style.display = "none"; - input.accept = mimeTypes; - input.onchange = async () => { - resolve(input.files?.[0] ?? null); - }; - - document.body.appendChild(input); - input.click(); - setImmediate(() => document.body.removeChild(input)); - }); -} - -/** - * Prompts the user to save a file to their system - * @param file The file to save - */ -export function saveFile(file: File) { - const a = document.createElement("a"); - a.href = URL.createObjectURL(file); - a.download = file.name; - - document.body.appendChild(a); - a.click(); - setImmediate(() => { - URL.revokeObjectURL(a.href); - document.body.removeChild(a); - }); -} - -export function classes(...classes: Array) { - return classes.filter(Boolean).join(" "); -} diff --git a/src/equicordplugins/discordColorways/wsClient.ts b/src/equicordplugins/discordColorways/wsClient.ts deleted file mode 100644 index 11b43436..00000000 --- a/src/equicordplugins/discordColorways/wsClient.ts +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore } from "."; -import { ColorwayCSS } from "./colorwaysAPI"; -import { updateBoundKeyMain, updateWSMain } from "./components/MainModal"; -import { updateActiveColorway, updateManagerRole, updateWS as updateWSSelector } from "./components/Selector"; -import { nullColorwayObj } from "./constants"; -import { generateCss } from "./css"; -import { ColorwayObject } from "./types"; -import { colorToHex } from "./utils"; - -export let wsOpen = false; -export let boundKey: { [managerKey: string]: string; } | null = null; -export let hasManagerRole: boolean = false; - -export let sendColorway: (obj: ColorwayObject) => void = () => { }; -export let requestManagerRole: () => void = () => { }; -export let updateRemoteSources: () => void = () => { }; -export let closeWS: () => void = () => { }; -export let restartWS: () => void = () => connect(); -export let updateShouldAutoconnect: (shouldAutoconnect: boolean) => void = () => connect(); - -function updateWS(status: boolean) { - updateWSSelector(status); - updateWSMain(status); -} - -function updateBoundKey(bound: { [managerKey: string]: string; }) { - updateBoundKeyMain(bound); -} - -export function connect() { - var ws: WebSocket | null = new WebSocket("ws://localhost:6124"); - - updateShouldAutoconnect = shouldAutoconnect => { - if (shouldAutoconnect && ws?.readyState === ws?.CLOSED) connect(); - }; - - ws.onopen = function () { - wsOpen = true; - hasManagerRole = false; - updateWS(true); - }; - - restartWS = () => { - ws?.close(); - connect(); - }; - closeWS = () => ws?.close(); - - ws.onmessage = function (e) { - const data: { - type: "change-colorway" | "remove-colorway" | "manager-connection-established" | "complication:remote-sources:received" | "complication:remote-sources:update-request" | "complication:manager-role:granted" | "complication:manager-role:revoked", - [key: string]: any; - } = JSON.parse(e.data); - - function typeSwitch(type) { - switch (type) { - case "change-colorway": - if (data.active.id == null) { - DataStore.set("activeColorwayObject", nullColorwayObj); - ColorwayCSS.remove(); - updateActiveColorway(nullColorwayObj); - } else { - const demandedColorway = generateCss( - colorToHex("#" + data.active.colors.primary || "#313338").replace("#", ""), - colorToHex("#" + data.active.colors.secondary || "#2b2d31").replace("#", ""), - colorToHex("#" + data.active.colors.tertiary || "#1e1f22").replace("#", ""), - colorToHex("#" + data.active.colors.accent || "#5865f2").replace("#", "") - ); - ColorwayCSS.set(demandedColorway); - DataStore.set("activeColorwayObject", { ...data.active, css: demandedColorway }); - updateActiveColorway({ ...data.active, css: demandedColorway }); - } - return; - case "remove-colorway": - DataStore.set("activeColorwayObject", nullColorwayObj); - ColorwayCSS.remove(); - updateActiveColorway(nullColorwayObj); - return; - case "manager-connection-established": - DataStore.get("colorwaysBoundManagers").then((boundManagers: { [managerKey: string]: string; }[]) => { - if (data.MID) { - const boundSearch = boundManagers.filter(boundManager => { - if (Object.keys(boundManager)[0] === data.MID) return boundManager; - }); - if (boundSearch.length) { - boundKey = boundSearch[0]; - } else { - const id = { [data.MID]: `vencord.${Math.random().toString(16).slice(2)}.${new Date().getUTCMilliseconds()}` }; - DataStore.set("colorwaysBoundManagers", [...boundManagers, id]); - boundKey = id; - } - updateBoundKey(typeof boundKey === "string" ? JSON.parse(boundKey) : boundKey); - ws?.send(JSON.stringify({ - type: "client-sync-established", - boundKey, - complications: [ - "remote-sources", - "manager-role" - ] - })); - DataStore.getMany([ - "colorwaySourceFiles", - "customColorways" - ]).then(([ - colorwaySourceFiles, - customColorways - ]) => { - ws?.send(JSON.stringify({ - type: "complication:remote-sources:init", - boundKey, - online: colorwaySourceFiles, - offline: customColorways - })); - }); - sendColorway = obj => ws?.send(JSON.stringify({ - type: "complication:manager-role:send-colorway", - active: obj, - boundKey - })); - requestManagerRole = () => ws?.send(JSON.stringify({ - type: "complication:manager-role:request", - boundKey - })); - updateRemoteSources = () => DataStore.getMany([ - "colorwaySourceFiles", - "customColorways" - ]).then(([ - colorwaySourceFiles, - customColorways - ]) => { - ws?.send(JSON.stringify({ - type: "complication:remote-sources:init", - boundKey, - online: colorwaySourceFiles, - offline: customColorways - })); - }); - } - }); - return; - case "complication:manager-role:granted": - hasManagerRole = true; - updateManagerRole(true); - return; - case "complication:manager-role:revoked": - hasManagerRole = false; - updateManagerRole(false); - return; - case "complication:remote-sources:update-request": - DataStore.getMany([ - "colorwaySourceFiles", - "customColorways" - ]).then(([ - colorwaySourceFiles, - customColorways - ]) => { - ws?.send(JSON.stringify({ - type: "complication:remote-sources:init", - boundKey, - online: colorwaySourceFiles, - offline: customColorways - })); - }); - return; - } - } - - typeSwitch(data.type); - }; - - ws.onclose = function (e) { - boundKey = null; - hasManagerRole = false; - sendColorway = () => { }; - requestManagerRole = () => { }; - updateRemoteSources = () => { }; - restartWS = () => connect(); - closeWS = () => { }; - try { - ws?.close(); - } catch (e) { - return; - } - ws = null; - wsOpen = false; - updateWS(false); - DataStore.getMany([ - "colorwaysManagerAutoconnectPeriod", - "colorwaysManagerDoAutoconnect" - ]).then(([ - colorwaysManagerAutoconnectPeriod, - colorwaysManagerDoAutoconnect - ]) => { - // eslint-disable-next-line no-constant-condition - if (colorwaysManagerDoAutoconnect || true) setTimeout(() => connect(), colorwaysManagerAutoconnectPeriod || 3000); - }); - }; - - ws.onerror = function (e) { - e.preventDefault(); - boundKey = null; - sendColorway = () => { }; - requestManagerRole = () => { }; - updateRemoteSources = () => { }; - restartWS = () => connect(); - closeWS = () => { }; - hasManagerRole = false; - ws?.close(); - ws = null; - wsOpen = false; - updateWS(false); - DataStore.getMany([ - "colorwaysManagerAutoconnectPeriod", - "colorwaysManagerDoAutoconnect" - ]).then(([ - colorwaysManagerAutoconnectPeriod, - colorwaysManagerDoAutoconnect - ]) => { - // eslint-disable-next-line no-constant-condition - if (colorwaysManagerDoAutoconnect || true) setTimeout(() => connect(), colorwaysManagerAutoconnectPeriod || 3000); - }); - }; -} diff --git a/src/equicordplugins/timezones/index.tsx b/src/equicordplugins/timezones/index.tsx index f6c9e7b6..6e16af71 100644 --- a/src/equicordplugins/timezones/index.tsx +++ b/src/equicordplugins/timezones/index.tsx @@ -151,7 +151,7 @@ export default definePlugin({ { find: 'backgroundColor:"COMPLETE"', replacement: { - match: /(?<=hasProfileEffect.+?)children:\[/, + match: /(?<=backgroundImage.+?)children:\[/, replace: "$&$self.renderProfileTimezone(arguments[0])," } },