Skip to content

Commit

Permalink
DiscordColorways v5.6.5.1, Info modal bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
DaBluLite committed Apr 29, 2024
1 parent f0f4417 commit 674a441
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
26 changes: 13 additions & 13 deletions DiscordColorways.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @name DiscordColorways
* @author DaBluLite
* @description A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways
* @version 5.6.5
* @version 5.6.5.1
* @authorId 582170007505731594
* @invite ZfPH6SDkMW
*/
Expand Down Expand Up @@ -301,6 +301,15 @@ function HexToHSL(H) {
l = +(l * 100).toFixed(1);
return [Math.round(h), Math.round(s), Math.round(l)];
}
const stringToHex = (str) => {
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;
};
const hexToString = (hex) => {
let str = "";
for (let i = 0; i < hex.length; i += 2) {
Expand Down Expand Up @@ -838,7 +847,7 @@ const mainColors = [
const name = "DiscordColorways";
const author = "DaBluLite";
const description = "A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways";
const version = "5.6.5";
const version = "5.6.5.1";
const authorId = "582170007505731594";
const invite = "ZfPH6SDkMW";
const creatorVersion = "1.19";
Expand Down Expand Up @@ -2684,7 +2693,7 @@ function ColorwayInfoModal({
color: Button.Colors.PRIMARY,
size: Button.Sizes.MEDIUM,
look: Button.Looks.OUTLINED,
style: { flex: "0 0 auto" },
style: { flex: "0 0 auto", maxWidth: "236px" },
onClick: () => {
openUserProfile(colorwayProps.authorID);
}
Expand All @@ -2699,15 +2708,6 @@ function ColorwayInfoModal({
look: Button.Looks.OUTLINED,
style: { flex: "0 0 auto" },
onClick: () => {
const stringToHex = (str) => {
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;
};
const colorwayIDArray = `${colorwayProps.accent},${colorwayProps.primary},${colorwayProps.secondary},${colorwayProps.tertiary}`;
const colorwayID = stringToHex(colorwayIDArray);
Clipboard.copy(colorwayID);
Expand Down Expand Up @@ -2746,7 +2746,7 @@ function ColorwayInfoModal({
});
}
},
"Delete..."
"Delete"
))), BdApi.React.createElement("div", { className: "colorwayInfo-row colorwayInfo-css" + (collapsedCSS ? " colorwaysCreator-settingCat-collapsed" : "") }, BdApi.React.createElement(Flex, { style: { gap: "10px", width: "100%", alignItems: "center" } }, BdApi.React.createElement(Forms.FormTitle, { style: { marginBottom: 0, width: "100%" } }, "CSS:"), BdApi.React.createElement(
Button,
{
Expand Down
15 changes: 2 additions & 13 deletions VencordUserPlugin/discordColorways/components/InfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Button, Clipboard, Forms, Text, Toasts, useState } from "@webpack/commo
import { ColorwayCSS } from "..";
import { generateCss, pureGradientBase } from "../css";
import { Colorway } from "../types";
import { colorToHex } from "../utils";
import { colorToHex, stringToHex } from "../utils";
import ThemePreviewCategory from "./ThemePreview";

export default function ({
Expand Down Expand Up @@ -70,7 +70,7 @@ export default function ({
color={Button.Colors.PRIMARY}
size={Button.Sizes.MEDIUM}
look={Button.Looks.OUTLINED}
style={{ flex: "0 0 auto" }}
style={{ flex: "0 0 auto", maxWidth: "236px" }}
onClick={() => {
openUserProfile(colorwayProps.authorID);
}}
Expand All @@ -83,17 +83,6 @@ export default function ({
look={Button.Looks.OUTLINED}
style={{ flex: "0 0 auto" }}
onClick={() => {
const stringToHex = (str: string) => {
let hex = "";
for (let i = 0; i < str.length; i++) {
const charCode = str.charCodeAt(i);
const hexValue = charCode.toString(16);

// Pad with zeros to ensure two-digit representation
hex += hexValue.padStart(2, "0");
}
return hex;
};
const colorwayIDArray = `${colorwayProps.accent},${colorwayProps.primary},${colorwayProps.secondary},${colorwayProps.tertiary}`;
const colorwayID = stringToHex(colorwayIDArray);
Clipboard.copy(colorwayID);
Expand Down
5 changes: 2 additions & 3 deletions VencordUserPlugin/discordColorways/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ export const ColorwayCSS = {
};

export const versionData = {
pluginVersion: "5.6.5",
pluginVersion: "5.6.5.1",
creatorVersion: "1.19",
};

export default definePlugin({
name: "DiscordColorways",
description:
"A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways",
description: "A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways",
authors: [{
name: "DaBluLite",
id: 582170007505731594n
Expand Down

0 comments on commit 674a441

Please sign in to comment.