UNPKG

1.75 kBTypeScriptView Raw
1/**
2 * Copied from: react-native/Libraries/StyleSheet/normalizeColor.js
3 * react-native/Libraries/StyleSheet/processColor.js
4 * https://github.com/wcandillon/react-native-redash/blob/master/src/Colors.ts
5 */
6import type { StyleProps } from './commonTypes';
7interface HSV {
8 h: number;
9 s: number;
10 v: number;
11}
12export declare const ColorProperties: string[];
13export declare function normalizeColor(color: unknown): number | null;
14export declare const opacity: (c: number) => number;
15export declare const red: (c: number) => number;
16export declare const green: (c: number) => number;
17export declare const blue: (c: number) => number;
18export declare const rgbaColor: (r: number, g: number, b: number, alpha?: number) => number | string;
19/**
20 * @param r - Red value (0-255)
21 * @param g - Green value (0-255)
22 * @param b - Blue value (0-255)
23 * @returns `{h: hue (0-1), s: saturation (0-1), v: value (0-1)}`
24 */
25export declare function RGBtoHSV(r: number, g: number, b: number): HSV;
26export declare const hsvToColor: (h: number, s: number, v: number, a: number) => number | string;
27export declare function isColor(value: unknown): boolean;
28export declare function processColor(color: unknown): number | null | undefined;
29export declare function processColorsInProps(props: StyleProps): void;
30export type ParsedColorArray = [number, number, number, number];
31export declare function convertToRGBA(color: unknown): ParsedColorArray;
32export declare function rgbaArrayToRGBAColor(RGBA: ParsedColorArray): string;
33export declare function toLinearSpace(RGBA: ParsedColorArray, gamma?: number): ParsedColorArray;
34export declare function toGammaSpace(RGBA: ParsedColorArray, gamma?: number): ParsedColorArray;
35export {};
36//# sourceMappingURL=Colors.d.ts.map
\No newline at end of file