From 9fdd2c7c1727f8d6da8f57390cc56cec3b4edbc5 Mon Sep 17 00:00:00 2001 From: Lewis Crichton Date: Sat, 9 Sep 2023 10:43:07 +0100 Subject: [PATCH] feat: better colorpicker --- src/components/VencordSettings/ThemesTab.tsx | 20 +++++++++++------- .../VencordSettings/themesStyles.css | 21 +++++++++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/components/VencordSettings/ThemesTab.tsx b/src/components/VencordSettings/ThemesTab.tsx index 410988f32..901b48877 100644 --- a/src/components/VencordSettings/ThemesTab.tsx +++ b/src/components/VencordSettings/ThemesTab.tsx @@ -56,6 +56,7 @@ const InviteActions = findByPropsLazy("resolveInvite"); const TrashIcon = findByCodeLazy("M5 6.99902V18.999C5 20.101 5.897 20.999"); const CogWheel = findByCodeLazy("18.564C15.797 19.099 14.932 19.498 14 19.738V22H10V19.738C9.069"); const FileInput: FileInput = findByCodeLazy("activateUploadDialogue="); +const EditPencil = findByCodeLazy("M19.2929 9.8299L19.9409 9.18278C21.353 7.77064", '["color","height","width"]'); // TinyColor is completely unmangled and it's duplicated in two modules! Fun! const TinyColor: tinycolor.Constructor = findByCodeLazy("this._gradientType="); const TextAreaProps = findLazy(m => typeof m.textarea === "string"); @@ -114,6 +115,8 @@ function Validators({ themeLinks }: { themeLinks: string[]; }) { function ColorPicker(props: ColorPickerProps) { const [color, setColor] = useState(props.value); + const correctedColor = color ? `#${color.toString(16).padStart(6, "0")}` : "#000000"; + return ( ( @@ -121,14 +124,15 @@ function ColorPicker(props: ColorPickerProps) { )} > {popoutProps => ( -
+
+ +
)}
); diff --git a/src/components/VencordSettings/themesStyles.css b/src/components/VencordSettings/themesStyles.css index 6038274f8..938d8f34b 100644 --- a/src/components/VencordSettings/themesStyles.css +++ b/src/components/VencordSettings/themesStyles.css @@ -27,3 +27,24 @@ .vc-settings-theme-author::before { content: "by "; } + +.vc-settings-theme-usercss-swatch { + display: flex; + align-items: center; + justify-content: center; + width: 69px; + height: 50px; + box-sizing: border-box; + position: relative; + border: 1px solid; + border-radius: 4px; + cursor: pointer; +} + +.vc-settings-theme-usercss-swatch-pencil { + position: absolute; + top: 4px; + right: 4px; + width: 14px; + height: 14px; +}