A SvelteKit skeleton tailwindcss dark mode component with dark|light|OS settings.
npm install @dirk-bester/dark-light``bash`
$ npm install --save @dirk-bester/dark-light
`svelt
import { osDarkLightWatcher } from '@dirk-bester/dark-light/dist';
}
`
`svelt`
You can pass in any controls you want. Buttons preserve a11y navigation.
- Devices have a dark mode setting.
- User's want the simplicity of coming to your website and immediately getting their setting.
- Some users even want the OS to switch between dark and light based on time of day.
- An inferior approach is to have a mishmash of custom settings that ignore the OS setting.
- Why force users to twiddle on your site? Do the right thing.
To build your library:
`bash`
npm run package
To create a production version of your showcase app:
`bash`
npm run build
You can preview the production build with npm run preview.
> To deploy your app, you may need to install an adapter for your target environment.
Go into the package.json and give your package the desired name through the "name" option. Also consider adding a "license" field and point it to a LICENSE file which you can create from a template (one popular option is the MIT license).
To publish your library to npm:
`bash``
npm publish