color-combos
Version:
Get accessibility information about colour combinations
73 lines (72 loc) • 1.71 kB
TypeScript
export interface Accessibility {
aa: boolean;
aaLarge: boolean;
aaa: boolean;
aaaLarge: boolean;
}
export interface ApcaEvaluation {
thresholdLc: number;
meets: boolean;
}
export type FontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
export interface MinimumFontSize {
100: number | "prohibited";
200: number | "prohibited";
300: number | "prohibited";
400: number | "prohibited";
500: number | "prohibited";
600: number | "prohibited";
700: number | "prohibited";
800: number | "prohibited";
900: number | "prohibited";
}
export interface ApcaOptions {
fontSize?: number;
fontWeight?: FontWeight;
}
export interface FontRequirement {
fontSize: number;
fontWeight: FontWeight;
minimumFontSize: number | "prohibited";
meetsRequirement: boolean;
}
export interface ApcaAccessibility {
lc: number;
polarity: "light-on-dark" | "dark-on-light";
minimumFontSize: MinimumFontSize;
fontRequirement?: FontRequirement;
readability: {
fluentText: ApcaEvaluation;
bodyText: ApcaEvaluation;
contentText: ApcaEvaluation;
largeText: ApcaEvaluation;
minimumText: ApcaEvaluation;
nonText: ApcaEvaluation;
};
}
export interface Combination {
accessibility: Accessibility;
color?: number[];
contrast: number;
hex: string;
model?: string;
valpha?: number;
apca?: ApcaAccessibility;
}
export interface ColorCombo {
color?: number[];
combinations: Combination[];
hex: string;
model?: string;
valpha?: number;
}
interface Options {
threshold?: number;
compact?: boolean;
uniq?: boolean;
apca?: ApcaOptions;
}
declare const ColorCombos: (colors: string[] | {
[name: string]: string;
}, options?: Options) => ColorCombo[] | false;
export default ColorCombos;