Overview:
The themed-jss is a library that offers theme-based styling using JSS. It integrates with callbag-jsx and React and provides automatic dark mode support. The library is type safe and can be used with other frameworks or without any frameworks.
Features:
- Theme-based styling based on JSS: Allows you to create styles based on a theme object.
- Integrates with callbag-jsx and React: Can be used with callbag-jsx renderers and React components.
- Automatic dark mode support: Provides automatic dark mode detection and injection of additional CSS rules.
- Type safe: Allows you to specify the theme object type, theme argument, this argument, and the theme type for components.
Installation:
To use themed-jss, follow these steps:
- Install the themed-jss package using npm:
npm install themed-jss
- Import the themed-jss library in your project:
import { createThemedJss } from 'themed-jss';
- Create your styles based on a theme:
const theme = {
primaryColor: 'red',
secondaryColor: 'blue',
};
const styles = {
button: {
backgroundColor: theme.primaryColor,
color: theme.secondaryColor,
},
};
- Use the theme object to add your styles to the document:
const themedJss = createThemedJss();
themedJss.add(styles);
Summary:
Themed-jss is a library that provides theme-based styling using JSS. It integrates with callbag-jsx and React and offers automatic dark mode support. The library is type safe, allowing you to specify the theme object type and other type requirements. Overall, it provides a convenient and flexible way to style your components based on themes.