Comments (3)
I figured it out :)
I need to use
import { useTheme } from "nextra-theme-docs";
export default function HomePage() {
const { theme } = useTheme();
return (
<div>
<span style={{ color: theme === "dark" ? "green" : "red" }}>
Hello World!
</span>
</div>
);
}
from nextra.
Hi, have you tried using useConfig provided by Nextra?
import { useConfig } from "nextra-theme-docs/dist/index.mjs";
export default function HomePage() {
const { darkMode } = useConfig();
return (
<div>
<span style={{ color: darkMode ? "white" : "black" }}>Hello World!</span>
</div>
);
}
from nextra.
In my case useConfig is here import { useConfig } from "nextra-theme-docs";
and its not working the way you showed
from nextra.
Related Issues (20)
- Using nextra-theme-docs with NextJS 14 - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. HOT 1
- How to write chemical equations with mhchem in LaTeX
- Favicon HOT 12
- Nextra 4 HOT 4
- Nextra with AppRouter and next-intl HOT 1
- nextra: `exports` does not export types for `.` HOT 1
- Bug: Images defined using link definitions are not loaded HOT 3
- Feature request: Vitepress-style callout markdown support HOT 4
- suggestion HOT 1
- Feedback for “Callout Component”
- Feedback for “Next.js I18n”: ERR_TOO_MANY_REDIRECTS HOT 2
- Adding support for cascade layers HOT 2
- Can't resolve 'flexsearch' HOT 10
- primarySaturation is not an option anymore HOT 2
- Feedback for “Quick Start” HOT 1
- It is not possible to mark more than one identical footnote. HOT 3
- Importing components from nextra/components does not work as expected HOT 5
- [Question] Auto-closed sidebar folders HOT 6
- Can't search text from custom components HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextra.