Package Exports
- next-image-themed
- next-image-themed/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (next-image-themed) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Next-Image-Themed
A Next.js Image Component that allows you to shows a different image in light and dark-mode, based on the users preference.
Installation
Using Yarn:
yarn add next-image-themedUsing NPM:
npm install next-image-themedUsage
import ThemedImage from "next-image-themed";
import LightModeImage from "assets/images/light-mode.png";
import DarkModeImage from "assets/images/dark-mode.png";
const MyComponent = () => (
<ThemedImage
// The image to show in light-mode.
light={LightModeImage}
// The image to show in dark-mode.
dark={DarkModeImage}
// Pass the rest of the props to the Image component as you normally would.
alt='My Image'
loading='lazy'
/>
);