Replaces the left sidebar with a header dropdown (flag + name), like 1xbet's region picker. The shown country resolves as: saved choice (cookie, then the member's profile so it follows them across devices), else Cloudflare's CF-IPCountry (Canada maps to Québec), else Québec. favoriteCountry becomes nullable so geo-detection isn't overridden by a default nobody chose. Emoji flags render as letters on Windows, so flags are now SVGs in /public/flags; country names are in French. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
100 lines
2.7 KiB
TypeScript
100 lines
2.7 KiB
TypeScript
/**
|
|
* One mascot, palette-swapped per country. `flagPrimary`/`flagSecondary` are
|
|
* the true flag hex values (used for the small flag swatch / badges).
|
|
* `accent`/`accentSoft` are OKLCH values tuned for legibility as a UI accent
|
|
* on a dark background — several flag colors (navy, dark green, deep red)
|
|
* are too dark/desaturated to use directly as an accent on dark UI, so they
|
|
* are lightened here rather than algorithmically derived, same as the
|
|
* manual-override policy described for the mascot palette.
|
|
*/
|
|
export interface CountryTheme {
|
|
code: string // ISO 3166-1 alpha-2, or a region code like 'CA-QC'
|
|
name: string
|
|
flagPrimary: string
|
|
flagSecondary: string
|
|
accent: string // oklch(), CSS custom property value
|
|
accentSoft: string // oklch() with alpha, for subtle backgrounds
|
|
}
|
|
|
|
const FALLBACK_ACCENT = 'oklch(0.77 0.118 84.8)' // LokiLab gold
|
|
|
|
export const COUNTRIES: CountryTheme[] = [
|
|
{
|
|
code: 'CA-QC',
|
|
name: 'Québec',
|
|
flagPrimary: '#1768C4',
|
|
flagSecondary: '#183653',
|
|
accent: 'oklch(0.62 0.16 255.5)',
|
|
accentSoft: 'oklch(0.62 0.16 255.5 / 14%)',
|
|
},
|
|
{
|
|
code: 'FR',
|
|
name: 'France',
|
|
flagPrimary: '#0055A4',
|
|
flagSecondary: '#EF4135',
|
|
accent: 'oklch(0.63 0.19 28.6)',
|
|
accentSoft: 'oklch(0.63 0.19 28.6 / 14%)',
|
|
},
|
|
{
|
|
code: 'US',
|
|
name: 'États-Unis',
|
|
flagPrimary: '#B22234',
|
|
flagSecondary: '#3C3B6E',
|
|
accent: 'oklch(0.6 0.17 20.7)',
|
|
accentSoft: 'oklch(0.6 0.17 20.7 / 14%)',
|
|
},
|
|
{
|
|
code: 'ES',
|
|
name: 'Espagne',
|
|
flagPrimary: '#AA151B',
|
|
flagSecondary: '#F1BF00',
|
|
accent: 'oklch(0.76 0.16 89.6)',
|
|
accentSoft: 'oklch(0.76 0.16 89.6 / 14%)',
|
|
},
|
|
{
|
|
code: 'IT',
|
|
name: 'Italie',
|
|
flagPrimary: '#009246',
|
|
flagSecondary: '#CE2B37',
|
|
accent: 'oklch(0.65 0.15 151.1)',
|
|
accentSoft: 'oklch(0.65 0.15 151.1 / 14%)',
|
|
},
|
|
{
|
|
code: 'PT',
|
|
name: 'Portugal',
|
|
flagPrimary: '#046A38',
|
|
flagSecondary: '#DA020E',
|
|
accent: 'oklch(0.63 0.14 153.6)',
|
|
accentSoft: 'oklch(0.63 0.14 153.6 / 14%)',
|
|
},
|
|
{
|
|
code: 'DZ',
|
|
name: 'Algérie',
|
|
flagPrimary: '#006233',
|
|
flagSecondary: '#D21034',
|
|
accent: 'oklch(0.6 0.13 153.7)',
|
|
accentSoft: 'oklch(0.6 0.13 153.7 / 14%)',
|
|
},
|
|
{
|
|
code: 'MA',
|
|
name: 'Maroc',
|
|
flagPrimary: '#C1272D',
|
|
flagSecondary: '#006233',
|
|
accent: 'oklch(0.58 0.19 25)',
|
|
accentSoft: 'oklch(0.58 0.19 25 / 14%)',
|
|
},
|
|
]
|
|
|
|
export function countryTheme(code: string): CountryTheme {
|
|
return (
|
|
COUNTRIES.find((c) => c.code === code) ?? {
|
|
code,
|
|
name: code,
|
|
flagPrimary: '#D7AE54',
|
|
flagSecondary: '#242B36',
|
|
accent: FALLBACK_ACCENT,
|
|
accentSoft: 'oklch(0.77 0.118 84.8 / 14%)',
|
|
}
|
|
)
|
|
}
|