Light logo in dark theme #475
Answered
by
dlarroder
duartecancela
asked this question in
Q&A
-
Hi, it's possible to change the logo image in dark mode? i would like to use a white svg image. |
Beta Was this translation helpful? Give feedback.
Answered by
dlarroder
Jun 9, 2022
Replies: 1 comment 1 reply
-
Yes, you can use the import React from 'react'
import { useTheme } from 'next-themes'
import LightLogo from './LightLogo'
import DarkLogo from './DarkLogo'
export default function Sample() {
const { theme } = useTheme()
return (
<div>
{theme === 'light' ? <LightLogo /> : <DarkLogo />}
<span>Nav Menus</span>
</div>
)
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
duartecancela
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, you can use the
useTheme()
hook to determine the current theme of your application. With that, you can dynamically change the logo you are rendering. For example: