Apply dark theme to prisms
See original GitHub issueHi there 👋 is there a way to change the theme for prism based on the color mode?
This is what I tried, but didn’t work:
import prismTheme from "@theme-ui/prism/presets/night-owl-light.json";
import prismThemeDark from "@theme-ui/prism/presets/night-owl.json";
export default {
useColorSchemeMediaQuery: true,
colors: {
text: "#000",
background: "#fff",
modes: {
dark: {
text: "#fff",
background: "#000",
primary: "#0cf",
},
},
},
styles: {
pre: {
fontFamily: "monospace",
overflowX: "auto",
padding: 3,
code: {
color: "inherit",
},
...prismTheme,
mode: {
dark: {
...prismThemeDark,
},
},
},
}
};
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Dark theme for Prism and 302+ apps — Dracula
Dracula is a color scheme for code editors and terminal emulators, including Prism and 302+ other apps. Check the instructions to learn how...
Read more >Modifying UI Settings (Prism Central) - Nutanix Support Portal
Prism Theme (Dark Mode). Click to enlarge Prism Dark Background, High Contrast View. Select Auto (OS defined) to apply background themes defined in...
Read more >Code highlighting (light & dark mode) with Prism.js - CodePen
A pen to highlight embedded code examples using Prism.js with a dark or light mode theme. Reference the CSS and JavaScript of this...
Read more >prism-theme-one-light-dark - npm
If the web application supports toggling between light and dark themes, then to inject the corresponding Prism theme, use raw-loader , a Webpack ......
Read more >theme-ui/prism
To theme the prism styles based on the colors defined in your theme.colors object, use the theme-ui preset, which will use the following...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ahmedelq Here’s a link! https://dev.theme-ui.com/guides/syntax-highlighting/
You can’t change the CSS of a component in dark mode from your theme. However, you can set colors to use for syntax highlighting inside each color mode, then refer to that color name in your syntax highlighting code, & they will update with your color modes.
Oh, this is cool! Sorry I didn’t notice 😃 Thanks a lot!