diff --git a/src/components/ThemeSettings/components/SettingColorComponent.tsx b/src/components/ThemeSettings/components/SettingColorComponent.tsx index 16c11af7..6adca4fa 100644 --- a/src/components/ThemeSettings/components/SettingColorComponent.tsx +++ b/src/components/ThemeSettings/components/SettingColorComponent.tsx @@ -7,61 +7,21 @@ import "./colorStyles.css"; import { classNameFactory } from "@api/Styles"; -import { LazyComponent } from "@utils/react"; -import { find, findByCodeLazy } from "@webpack"; -import { Forms, Popout, useMemo, useState } from "@webpack/common"; +import { findByCodeLazy, findComponentByCodeLazy } from "@webpack"; +import { Forms, useMemo, useState } from "@webpack/common"; interface ColorPickerProps { - value: number | null; + color: number | null; showEyeDropper?: boolean; onChange(value: number | null): void; - onClose?(): void; } -const ColorPickerModal = LazyComponent(() => find(m => m?.type?.toString?.().includes(".showEyeDropper"))); +const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR"); // TinyColor is completely unmangled and it's duplicated in two modules! Fun! const TinyColor: tinycolor.Constructor = findByCodeLazy("this._gradientType="); const cl = classNameFactory("vc-usercss-settings-color-"); -// const EditPencil = findByCodeLazy("M19.2929 9.8299L19.9409 9.18278C21.353 7.77064", '["color","height","width"]'); - -function EditPencil({ className, color }) { - return ( - - - - ); -} - -function ColorPicker(props: ColorPickerProps & { width: number; height: number; }) { - const [color, setColor] = useState(props.value); - - const correctedColor = color ? `#${color.toString(16).padStart(6, "0")}` : "#000000"; - - return ( - ( - { setColor(value); props.onChange(value); }} showEyeDropper={props.showEyeDropper} /> - )} - > - {popoutProps => ( -
- -
- )} -
- ); -} - interface Props { label: string; name: string; @@ -86,10 +46,8 @@ export function SettingColorComponent({ label, name, themeSettings }: Props) {
{label}
diff --git a/src/components/ThemeSettings/components/colorStyles.css b/src/components/ThemeSettings/components/colorStyles.css index b76f0bed..8b7bfc51 100644 --- a/src/components/ThemeSettings/components/colorStyles.css +++ b/src/components/ThemeSettings/components/colorStyles.css @@ -1,22 +1,3 @@ -.vc-usercss-settings-color-swatch { - display: flex; - align-items: center; - justify-content: center; - box-sizing: border-box; - position: relative; - border: 1px solid; - border-radius: 4px; - cursor: pointer; -} - -.vc-usercss-settings-color-swatch-pencil { - position: absolute; - top: 4px; - right: 4px; - width: 14px; - height: 14px; -} - .vc-usercss-settings-color-swatch-row { display: flex; flex-direction: row; @@ -36,7 +17,3 @@ font-weight: 500; word-wrap: break-word; } - -.vc-usercss-settings-color-swatch-row > .vc-usercss-settings-color-swatch { - flex: 0 0 auto; -}