I was looking around, but couldn't find any related Q&A out there. I'm building a project in ReactJS with tailwindCSS, and implementing dark mode to the site. Everything works fine, but now I have some issues with a background image.
I have set the two image in the tailwind.config.js
darkMode: 'class',
theme: {
extend: {
backgroundImage: (theme) => ({
'code': "url('/src/components/About/coding-bg-dark.png')",
'light-code': "url('/src/components/About/lightcode.png')",
})
},
},
and have the classNames on the decent section
<section id='introduction' className="bg-code dark:bg-light-code bg-cover bg-fixed flex flex-wrap content-center w-full md:h-screen">
but when I toggle dark mode, the image doesn't change, the dark image stays on the light mode. Any idea how could I go around?
tailwind.config.js
, so luckily was just a one-liner. I am using class in the darkMode module, so the user can toggle between the light and dark mode and doesn't depend on system preferences, but it works with class as well. Have a good one, and thank you again. – Lebna