diff --git a/src/def.d.ts b/src/def.d.ts index 23d34a5..7505e9d 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -340,6 +340,11 @@ interface VendettaObject { getAssetByID: (id: number) => Asset; getAssetIDByName: (name: string) => number; }; + color: { + // TODO: Make a vain attempt to type these + map: Indexable; + raw: Indexable; + } }; plugins: { plugins: Indexable; diff --git a/src/ui/color.ts b/src/ui/color.ts new file mode 100644 index 0000000..33d15bd --- /dev/null +++ b/src/ui/color.ts @@ -0,0 +1,12 @@ +import { findByProps } from "@metro/filters"; +import { constants } from "@metro/hoist"; + +//! This module is only found on 165.0+, under the assumption that iOS 165.0 is the same as Android 165.0. +//* In 167.1, most if not all traces of the old color modules were removed. +const colorModule = findByProps("SemanticColorsByThemeTable"); + +//? SemanticColor is effectively ThemeColorMap +export const map = (colorModule?.SemanticColor ?? constants.ThemeColorMap); + +//? RawColor is effectively Colors +export const raw = (colorModule?.RawColor ?? constants.Colors); \ No newline at end of file diff --git a/src/ui/settings/components/PluginCard.tsx b/src/ui/settings/components/PluginCard.tsx index b259318..f5de1dc 100644 --- a/src/ui/settings/components/PluginCard.tsx +++ b/src/ui/settings/components/PluginCard.tsx @@ -1,20 +1,13 @@ -import { ReactNative as RN, stylesheet, constants, NavigationNative } from "@metro/common"; +import { ReactNative as RN, stylesheet, NavigationNative } from "@metro/common"; import { findByProps } from "@metro/filters"; import { Forms, General } from "@ui/components"; import { Plugin } from "@types"; import { getAssetIDByName } from "@ui/assets"; import { showToast } from "@ui/toasts"; +import { map as colorMap } from "@ui/color"; import { removePlugin, startPlugin, stopPlugin, getSettings } from "@lib/plugins"; import copyText from "@utils/copyText"; -//! This module is only found on 165.0+, under the assumption that iOS 165.0 is the same as Android 165.0. -//* In 167.1 (Android alpha at the time of writing), stylesheet.ThemeColorMap is gone, and constants.ThemeColorMap has broken behaviour. -//? SemanticColor is effectively ThemeColorMap -//? RawColor is effectively Colors -// TODO: Should this hotfix be moved elsewhere? Maybe a prop on window object, for plugins to use. -const colorModule = findByProps("SemanticColorsByThemeTable"); -const colorMap = (colorModule?.SemanticColor ?? constants.ThemeColorMap); - // TODO: Replace with our eventual dialog API const Dialog = findByProps("show", "openLazy", "close");