// src/report/styles.ts — Brand styles and font registration for PDF reports import { Font, StyleSheet } from '@react-pdf/renderer'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __dirname = dirname(fileURLToPath(import.meta.url)); const assetsDir = join(__dirname, 'assets'); // Register Barlow font family from bundled files Font.register({ family: 'Barlow', fonts: [ { src: join(assetsDir, 'fonts', 'Barlow-Regular.ttf'), fontWeight: 400 }, { src: join(assetsDir, 'fonts', 'Barlow-Medium.ttf'), fontWeight: 500 }, { src: join(assetsDir, 'fonts', 'Barlow-SemiBold.ttf'), fontWeight: 600 }, { src: join(assetsDir, 'fonts', 'Barlow-Bold.ttf'), fontWeight: 700 }, ], }); export const logoPath = join(assetsDir, 'Indemn_PrimaryLogo_Iris.png'); // Brand colors from Indemn Brand Guide export const colors = { // Primary brand colors iris: '#4752a3', lilac: '#a67cb7', eggplant: '#1e2553', white: '#ffffff', // Supporting brand colors lime: '#e0da67', olive: '#2a2b1a', // Derived UI colors background: '#f4f3f8', muted: '#6b7094', border: '#d4d7e3', // Semantic colors success: '#22c55e', error: '#ef4444', warning: '#f59e0b', }; // Shared styles export const styles = StyleSheet.create({ page: { fontFamily: 'Barlow', fontSize: 11, color: colors.eggplant, backgroundColor: colors.white, padding: 40, }, pageHeader: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 24, paddingBottom: 12, borderBottomWidth: 1, borderBottomColor: colors.border, }, pageTitle: { fontSize: 18, fontWeight: 600, color: colors.iris, }, pageNumber: { fontSize: 9, color: colors.muted, }, sectionTitle: { fontSize: 14, fontWeight: 600, color: colors.iris, marginBottom: 12, }, bodyText: { fontSize: 11, fontWeight: 400, color: colors.eggplant, lineHeight: 1.5, marginBottom: 8, }, caption: { fontSize: 9, fontWeight: 500, color: colors.muted, }, card: { backgroundColor: colors.background, borderRadius: 6, padding: 16, marginBottom: 12, }, metricValue: { fontSize: 28, fontWeight: 700, color: colors.eggplant, }, metricLabel: { fontSize: 10, fontWeight: 500, color: colors.muted, marginTop: 4, }, row: { flexDirection: 'row', }, col: { flex: 1, }, footer: { position: 'absolute', bottom: 30, left: 40, right: 40, flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingTop: 12, borderTopWidth: 1, borderTopColor: colors.border, }, // Evaluation-specific styles scorePass: { color: colors.success, }, scoreFail: { color: colors.error, }, severityHigh: { color: '#3a4389', // Dark iris }, severityMedium: { color: colors.iris, // Standard iris }, severityLow: { color: '#7c85c0', // Light iris }, });