-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix light theme accessibility * fix dark theme * fix format * Fix formatting --------- Co-authored-by: Davor Runje <[email protected]> Co-authored-by: Chi Wang <[email protected]>
- Loading branch information
1 parent
73c7522
commit 0f59322
Showing
4 changed files
with
60 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const fixColorContrast = (selector, color) => { | ||
const elements = document.querySelectorAll(selector); | ||
if (elements.length > 0) { | ||
elements.forEach(element => { | ||
element.style.color = color; | ||
}); | ||
} | ||
} | ||
|
||
const observer = new MutationObserver(() => { | ||
const hashLinks = document.querySelectorAll('.hash-link[title="Direct link to heading"]'); | ||
if (hashLinks.length > 0) { | ||
hashLinks.forEach(link => { | ||
link.setAttribute('tabindex', '-1'); | ||
}); | ||
} | ||
|
||
fixColorContrast('.token.comment', '#8a93c8') | ||
fixColorContrast('.token.boolean', '#ff5c79') | ||
fixColorContrast('blockquote a', '#0d55b4') | ||
fixColorContrast('.ant-select-selection-placeholder', '#747474') | ||
}); | ||
|
||
observer.observe(document, { | ||
childList: true, | ||
subtree: true | ||
}); |