[UI] Export and use color variables
This commit is contained in:
parent
7755f97ab2
commit
3f3bfcb78c
3 changed files with 19 additions and 9 deletions
5
src/def.d.ts
vendored
5
src/def.d.ts
vendored
|
@ -340,6 +340,11 @@ interface VendettaObject {
|
||||||
getAssetByID: (id: number) => Asset;
|
getAssetByID: (id: number) => Asset;
|
||||||
getAssetIDByName: (name: string) => number;
|
getAssetIDByName: (name: string) => number;
|
||||||
};
|
};
|
||||||
|
color: {
|
||||||
|
// TODO: Make a vain attempt to type these
|
||||||
|
map: Indexable<any>;
|
||||||
|
raw: Indexable<any>;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
plugins: {
|
plugins: {
|
||||||
plugins: Indexable<Plugin>;
|
plugins: Indexable<Plugin>;
|
||||||
|
|
12
src/ui/color.ts
Normal file
12
src/ui/color.ts
Normal file
|
@ -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);
|
|
@ -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 { findByProps } from "@metro/filters";
|
||||||
import { Forms, General } from "@ui/components";
|
import { Forms, General } from "@ui/components";
|
||||||
import { Plugin } from "@types";
|
import { Plugin } from "@types";
|
||||||
import { getAssetIDByName } from "@ui/assets";
|
import { getAssetIDByName } from "@ui/assets";
|
||||||
import { showToast } from "@ui/toasts";
|
import { showToast } from "@ui/toasts";
|
||||||
|
import { map as colorMap } from "@ui/color";
|
||||||
import { removePlugin, startPlugin, stopPlugin, getSettings } from "@lib/plugins";
|
import { removePlugin, startPlugin, stopPlugin, getSettings } from "@lib/plugins";
|
||||||
import copyText from "@utils/copyText";
|
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
|
// TODO: Replace with our eventual dialog API
|
||||||
const Dialog = findByProps("show", "openLazy", "close");
|
const Dialog = findByProps("show", "openLazy", "close");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue