-
Notifications
You must be signed in to change notification settings - Fork 41
Description
The Problem
At the moment the project is hard coded to use rose-pine-moon color scheme, including the background and text colors on the components
Initial thoughts
I'd like to know if it would be interesting to refactor everything to allow easier colors customization. After doing some research I've found out that the library shiki provides the following methods for the getHighlighter function:
const myTheme = 'rose-pine-moon'
const highlighter = await shiki.getHighlighter({
theme: myTheme
})
highlighter.getBackgroundColor(myTheme) // #232136
highlighter.getForegroundColor(myTheme) // #e0def4With this, it opens the doors for what @isneru tried to implement in their PR
After some more digging through shiki library I've discovered all of their current supported themes, it's available on their docs or by running the following code:
console.log(shiki.BUNDLED_THEMES)Click to expand the array
[
'css-variables',
'dark-plus',
'dracula-soft',
'dracula',
'github-dark-dimmed',
'github-dark',
'github-light',
'hc_light',
'light-plus',
'material-theme-darker',
'material-theme-lighter',
'material-theme-ocean',
'material-theme-palenight',
'material-theme',
'min-dark',
'min-light',
'monokai',
'nord',
'one-dark-pro',
'poimandres',
'rose-pine-dawn',
'rose-pine-moon',
'rose-pine',
'slack-dark',
'slack-ochin',
'solarized-dark',
'solarized-light',
'vitesse-dark',
'vitesse-light'
]Drawbacks
It seems like they don't have yet a large amount of themes available, so a dynamic theme switch using Diego's Gist could very quickly break away from the library's supported themes. In a situation like this a fallback theme rose-pine-moon for example could be provided.
Final thoughts
I feel like this is a nice feature to explore and we can take away two outcomes from discussing it more below in the comments. Here are the outcomes:
- We just refactor everything to use colors from
tailwind.config.jsinstead of hard coding them. - We discuss further the implementation of such dynamic theming coming from the Gist with some sort of fallback.
Please let me know what you think.