@casoon/auditmysite
Version:
Professional website analysis suite with robust accessibility testing, Core Web Vitals performance monitoring, SEO analysis, and content optimization insights. Features isolated browser contexts, retry mechanisms, and comprehensive API endpoints for profe
59 lines • 1.77 kB
TypeScript
/**
* 🎨 Color Contrast Helper
*
* Analyzes color contrast issues and provides actionable recommendations
* with specific color suggestions that meet WCAG standards.
*/
export interface ColorPair {
foreground: string;
background: string;
contrastRatio: number;
}
export interface ColorRecommendation {
originalForeground: string;
originalBackground: string;
currentRatio: number;
requiredRatio: number;
level: 'AA' | 'AAA';
suggestions: {
foreground?: string[];
background?: string[];
explanation: string;
};
}
/**
* Calculate contrast ratio between two colors
* Formula from WCAG 2.0: https://www.w3.org/TR/WCAG20/#contrast-ratiodef
*/
export declare function calculateContrastRatio(fg: string, bg: string): number;
/**
* Get color recommendations for contrast issues
*/
export declare function getColorRecommendations(foreground: string, background: string, textSize?: 'normal' | 'large', targetLevel?: 'AA' | 'AAA'): ColorRecommendation;
/**
* Analyze common Tailwind CSS color combinations
*/
export declare function analyzeTailwindContrast(className: string, background?: string): {
meetsAA: boolean;
meetsAAA: boolean;
ratio: number;
recommendation?: string;
};
/**
* Generate contrast fix CSS
*/
export declare function generateContrastFixCSS(selector: string, originalColor: string, background: string): string;
/**
* Batch analyze colors from accessibility report
*/
export declare function analyzeContrastIssues(issues: Array<{
selector: string;
context: string;
code: string;
}>): Array<{
selector: string;
issue: string;
recommendation: ColorRecommendation;
fixCSS: string;
}>;
//# sourceMappingURL=color-contrast-helper.d.ts.map