Skip to content

Commit e5dea38

Browse files
Add theme-aware support links and gamepad icons
Introduce .support-card-link CSS to ensure support page anchors use the correct text and hover colors across themes, and update support.html to apply this class to the support cards instead of the hardcoded link-light class. In assets/js/gamepad-tester.js add a MutationObserver to listen for data-bs-theme changes (reinitializing button images when the theme changes) and select Black/White icon variants based on the current theme so controller button images remain visible in both light and dark modes.
1 parent 572f355 commit e5dea38

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

_sass/styles.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,15 @@ table tr:nth-child(2n) {
289289
color: var(--hover-col);
290290
}
291291

292+
/* Support card link styling */
293+
.support-card-link {
294+
color: var(--text-col);
295+
}
296+
297+
.support-card-link:hover {
298+
color: var(--link-col);
299+
}
300+
292301
/* Language icons - add shadow in light mode for visibility */
293302
[data-bs-theme="light"] .language-logo {
294303
filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 1));

assets/js/gamepad-tester.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ document.addEventListener('DOMContentLoaded', function() {
1717
return;
1818
}
1919

20+
// Watch for theme changes to update button images
21+
const themeObserver = new MutationObserver(function(mutations) {
22+
mutations.forEach(function(mutation) {
23+
if (mutation.type === 'attributes' && mutation.attributeName === 'data-bs-theme') {
24+
// Theme changed, reinitialize buttons with new color scheme
25+
if (activeGamepadIndex !== null) {
26+
initGamepadButtons();
27+
}
28+
}
29+
});
30+
});
31+
32+
// Start observing theme changes on the document element
33+
themeObserver.observe(document.documentElement, {
34+
attributes: true,
35+
attributeFilter: ['data-bs-theme']
36+
});
37+
2038
// Setup gamepad event listeners
2139
window.addEventListener("gamepadconnected", function(e) {
2240
gamepads[e.gamepad.index] = e.gamepad;
@@ -158,12 +176,17 @@ document.addEventListener('DOMContentLoaded', function() {
158176

159177
const controllerType = gamepadHelper.detectControllerType(gamepad.id);
160178

179+
// Detect current theme - use Black icons for light theme, White icons for dark theme
180+
const isDarkTheme = document.documentElement.getAttribute('data-bs-theme') === 'dark';
181+
const colorScheme = isDarkTheme ? 'White' : 'Black';
182+
161183
for (let i = 0; i < gamepad.buttons.length; i++) {
162184
const buttonName = gamepadHelper.getButtonName(controllerType, i);
163185
const buttonImagePath = gamepadHelper.getButtonImagePath(
164186
controllerType,
165187
i,
166188
`https://cdn.jsdelivr.net/npm/@lizardbyte/gamepad-helper@${gamepadHelperVersion}/assets/img/gamepads/`,
189+
colorScheme
167190
);
168191

169192
const buttonDiv = document.createElement('div');

support.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1>
2525
</h1>
2626
</div>
2727
<div class="col-sm-auto border-white my-3 px-3 py-2 border-start">
28-
<a class="text-decoration-none link-light stretched-link"
28+
<a class="text-decoration-none support-card-link stretched-link"
2929
href="https://docs.lizardbyte.dev/latest/about/overview.html"
3030
target="_blank">
3131
<h4 class="card-title mb-3 fw-bolder crowdin-ignore">Read the Docs</h4>
@@ -68,7 +68,7 @@ <h1>
6868
</h1>
6969
</div>
7070
<div class="col-sm-auto border-white my-3 px-3 py-2 border-start">
71-
<a class="text-decoration-none link-light stretched-link"
71+
<a class="text-decoration-none support-card-link stretched-link"
7272
href="{{ '/discord' | relative_url }}">
7373
<h4 class="card-title mb-3 fw-bolder crowdin-ignore">Discord</h4>
7474
</a>
@@ -99,7 +99,7 @@ <h1>
9999
</h1>
100100
</div>
101101
<div class="col-sm-auto border-white my-3 px-3 py-2 border-start">
102-
<a class="text-decoration-none link-light stretched-link"
102+
<a class="text-decoration-none support-card-link stretched-link"
103103
href="https://github.com/orgs/LizardByte/discussions">
104104
<h4 class="card-title mb-3 fw-bolder crowdin-ignore">GitHub</h4>
105105
</a>
@@ -129,7 +129,7 @@ <h1>
129129
</h1>
130130
</div>
131131
<div class="col-sm-auto border-white my-3 px-3 py-2 border-start">
132-
<a class="text-decoration-none link-light stretched-link"
132+
<a class="text-decoration-none support-card-link stretched-link"
133133
href="https://www.reddit.com/r/LizardByte" target="_blank">
134134
<h4 class="card-title mb-3 fw-bolder crowdin-ignore">Reddit</h4>
135135
</a>

0 commit comments

Comments
 (0)