diff --git a/apps/website/cv-theme.js b/apps/website/cv-theme.js
index b40701a..63b3593 100644
--- a/apps/website/cv-theme.js
+++ b/apps/website/cv-theme.js
@@ -1,5 +1,22 @@
const cvThemeButtons = [...document.querySelectorAll('[data-cv-theme]')];
const cvPortrait = document.getElementById('cv-portrait-orbit');
+const cvThemeStorageKey = 'cv-theme';
+
+function getStoredCvTheme() {
+ try {
+ return localStorage.getItem(cvThemeStorageKey);
+ } catch (_error) {
+ return null;
+ }
+}
+
+function storeCvTheme(theme) {
+ try {
+ localStorage.setItem(cvThemeStorageKey, theme);
+ } catch (_error) {
+ // Theme switching should still work when storage is blocked.
+ }
+}
function setCvTheme(theme) {
const nextTheme = theme === 'fancy' ? 'fancy' : 'elegant';
@@ -12,7 +29,7 @@ function setCvTheme(theme) {
button.setAttribute('aria-pressed', active ? 'true' : 'false');
});
- localStorage.setItem('cv-theme', nextTheme);
+ storeCvTheme(nextTheme);
}
cvThemeButtons.forEach((button) => {
@@ -31,4 +48,5 @@ document.addEventListener('pointermove', (event) => {
cvPortrait.style.setProperty('--portrait-rotation', `${degrees + 8}deg`);
});
-setCvTheme(localStorage.getItem('cv-theme') || 'elegant');
+setCvTheme(getStoredCvTheme() || 'elegant');
+
diff --git a/apps/website/cv.php b/apps/website/cv.php
index 8973791..3258e71 100644
--- a/apps/website/cv.php
+++ b/apps/website/cv.php
@@ -169,10 +169,11 @@
-
+