fix: force text-slate to black in PDF export for better contrast
This commit is contained in:
@@ -19,8 +19,12 @@ export const exportAsPdf = async (elementId: string, fileName: string, action: '
|
||||
const isDark = document.documentElement.classList.contains('dark');
|
||||
if (isDark) {
|
||||
document.documentElement.classList.remove('dark');
|
||||
await new Promise(resolve => setTimeout(resolve, 100)); // Allow CSS to recompute
|
||||
}
|
||||
|
||||
// Add pdf-export class to force high contrast text
|
||||
container.classList.add('pdf-export');
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 100)); // Allow CSS to recompute
|
||||
|
||||
const pdf = new jsPDF({
|
||||
orientation: 'portrait',
|
||||
@@ -50,6 +54,8 @@ export const exportAsPdf = async (elementId: string, fileName: string, action: '
|
||||
pdf.addImage(imgData, 'JPEG', 0, 0, pdfWidth, pdfHeight);
|
||||
}
|
||||
|
||||
container.classList.remove('pdf-export');
|
||||
|
||||
if (isDark) {
|
||||
document.documentElement.classList.add('dark');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user