Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix Accessibility Bug] Refactor code.js to improve syntax highlighting colors #1305

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jpg619
Copy link
Contributor

@jpg619 jpg619 commented Oct 2, 2024

WHAT

This pull request introduces a new function to handle custom token styling in the Code component and refactors the existing code to utilize this new function. The most important changes include the addition of the getCustomTokenStyle function and the refactoring of the Code component to use this function for token styling.

Styling improvements:

  • src/mdx/code.js: Added the getCustomTokenStyle function to handle custom token styles based on their class names.

Code refactoring:

  • src/mdx/code.js: Refactored the Code component to use the getCustomTokenStyle function for determining the style of each token, simplifying the code and improving maintainability.

WHY

BEFORE

screen shot before colour red before colour blue before

AFTER

screen shot after colour red after colour blue after

@jpg619 jpg619 self-assigned this Oct 2, 2024
@jpg619 jpg619 changed the title Refactor code.js to improve syntax highlighting colors [Fix Accessibility Bug] Refactor code.js to improve syntax highlighting colors Oct 2, 2024
@wraithgar
Copy link
Member

Isn't this the kind of thing css styles is designed to solve? Can we not set this color based on the class in css?

@jpg619 jpg619 marked this pull request as draft October 3, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants