Skip to content

Commit 0aba7c6

Browse files
committed
docs
1 parent 6f58939 commit 0aba7c6

File tree

2 files changed

+66
-25
lines changed

2 files changed

+66
-25
lines changed

docs/src/components/BuildConfigTool.astro

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -910,11 +910,56 @@ const advancedOptions = configOptions.filter(
910910
}
911911
</style>
912912

913-
<!-- Prism.js -->
914-
<link
915-
rel="stylesheet"
916-
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-dark.min.css"
917-
/>
913+
<!-- Prism.js - Theme-aware loading -->
914+
<script is:inline>
915+
// Load and manage Prism theme switching
916+
(function() {
917+
let currentPrismLink = null;
918+
919+
function loadPrismTheme(isLight = false) {
920+
// Remove existing Prism theme
921+
if (currentPrismLink) {
922+
currentPrismLink.remove();
923+
}
924+
925+
// Create new theme link
926+
currentPrismLink = document.createElement('link');
927+
currentPrismLink.rel = 'stylesheet';
928+
currentPrismLink.id = 'prism-theme';
929+
currentPrismLink.href = isLight
930+
? 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css'
931+
: 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-dark.min.css';
932+
document.head.appendChild(currentPrismLink);
933+
}
934+
935+
// Initial theme load
936+
const initialTheme = document.documentElement.getAttribute('data-theme');
937+
loadPrismTheme(initialTheme === 'light');
938+
939+
// Watch for theme changes
940+
const observer = new MutationObserver((mutations) => {
941+
mutations.forEach((mutation) => {
942+
if (mutation.type === 'attributes' && mutation.attributeName === 'data-theme') {
943+
const newTheme = document.documentElement.getAttribute('data-theme');
944+
loadPrismTheme(newTheme === 'light');
945+
946+
// Re-highlight after theme change
947+
setTimeout(() => {
948+
if (typeof window.Prism !== 'undefined') {
949+
window.Prism.highlightAll();
950+
}
951+
}, 100);
952+
}
953+
});
954+
});
955+
956+
observer.observe(document.documentElement, {
957+
attributes: true,
958+
attributeFilter: ['data-theme']
959+
});
960+
})();
961+
</script>
962+
918963
<script
919964
is:inline
920965
src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"

docs/src/styles/custom.css

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,34 +63,34 @@
6363
--sl-color-accent-low: #e8f5f2;
6464
--sl-color-accent: #0d4d3f;
6565
--sl-color-accent-high: #002d26;
66-
--sl-color-white: #2a1a36;
67-
--sl-color-gray-1: #3d1f5c;
68-
--sl-color-gray-2: #4d3570;
69-
--sl-color-gray-3: #745294;
70-
--sl-color-gray-4: #a685cc;
71-
--sl-color-gray-5: #d6c8ea;
72-
--sl-color-gray-6: #f5edff;
66+
--sl-color-white: #1a1a1a;
67+
--sl-color-gray-1: #2a2a2a;
68+
--sl-color-gray-2: #333333;
69+
--sl-color-gray-3: #555555;
70+
--sl-color-gray-4: #777777;
71+
--sl-color-gray-5: #999999;
72+
--sl-color-gray-6: #bbbbbb;
7373
--sl-color-gray-7: #e8e4f0;
74-
--sl-color-black: #f2f1f1;
74+
--sl-color-black: #f8f8f8;
7575

7676
/* Enhanced Light Mode Buttons */
77-
--sl-button-bg-primary: #b8d6c7;
78-
--sl-button-bg-secondary: #c9b8d4;
77+
--sl-button-bg-primary: #d4e8dc;
78+
--sl-button-bg-secondary: #e0d4e8;
7979

8080
/* Interactive Elements */
8181
--react-toggle-checked: #9f4aa8;
8282

83-
/* Content Areas */
84-
--details-1: #b8ccaa;
85-
--details-2: #5a1085;
86-
--details-3: #e2e2e2;
83+
/* Content Areas - Fixed contrast issues */
84+
--details-1: #f0f8f4;
85+
--details-2: #e8f0f8;
86+
--details-3: #f5f5f5;
8787

8888
/* Links with Better Contrast */
8989
--url-colour: #7a0fa3 !important;
9090
--url-colour-hover: #1a6b5f !important;
9191

9292
/* Code Styling */
93-
--code-inline-background: #e8f5f2;
93+
--code-inline-background: #f8faf9;
9494
--code-inline-color: #1a1a1a;
9595
--code-inline-border: #4a9b7f;
9696

@@ -102,7 +102,7 @@
102102

103103
/* UI Elements */
104104
--steps-border: #9f4aa8;
105-
--modal-url-color: var(--sl-color-black);
105+
--modal-url-color: #1a1a1a;
106106
--modal-url-hover-color: #000;
107107
--modal-url-bg-color: var(--code-inline-border);
108108
--modal-url-bg-hv-color: #2ec7bf;
@@ -627,10 +627,6 @@ a[tabindex="-1"]:hover {
627627
opacity: 1;
628628
}
629629

630-
:root[data-theme="light"] .starlight-aside {
631-
border: 1px solid rgba(0, 0, 0, 0.1);
632-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
633-
}
634630

635631
:root[data-theme="light"] .react-toggle-track {
636632
background-color: #d1c2dc !important;

0 commit comments

Comments
 (0)