You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reposting this as an issue from another discussion around dark mode here: #33
Shiki claims to support css-variables via a hack workaround using a special theme and last-second remap of colors. I see several issues with this approach:
No clear API, functionality is triggered by a theme name ('css-variables')
Limited to only 12 colors
No control over color names. I'm forced to use colors like shiki-token-punctuation for something semantically different to make use of all 12 colors.
The current COLOR_REPLACEMENT map contains errors, there is no entry for 000003:
...add some new option on ShikiTheme like cssVariables: boolean? Or extend type to be light | dark | css, and trigger the remap based on that?
Seems to me that by doing this it would unlock full theming via CSS Variables and resolve all dark-mode issues, including my problems listed above. Users would be able to swap out any colors they'd like for a CSS variable instead.
The text was updated successfully, but these errors were encountered:
Submitted my changes in #314. This is working perfect for my needs, I can now create a theme that is completely controlled by CSS, making it super easy to support Dark Mode. Would love to see this merged so let me know your feedback.
Reposting this as an issue from another discussion around dark mode here:
#33
Shiki claims to support css-variables via a hack workaround using a special theme and last-second remap of colors. I see several issues with this approach:
shiki-token-punctuation
for something semantically different to make use of all 12 colors.shiki/packages/shiki/src/highlighter.ts
Line 69 in 4478d64
Instead of the hacky and limited css-variables theme, why not just enable the user to supply their own color remap here:
shiki/packages/shiki/src/highlighter.ts
Line 67 in 4478d64
And instead of the name check here:
shiki/packages/shiki/src/highlighter.ts
Line 99 in 4478d64
...add some new option on ShikiTheme like
cssVariables: boolean?
Or extendtype
to belight | dark | css
, and trigger the remap based on that?Seems to me that by doing this it would unlock full theming via CSS Variables and resolve all dark-mode issues, including my problems listed above. Users would be able to swap out any colors they'd like for a CSS variable instead.
The text was updated successfully, but these errors were encountered: