@bkbaalkrshna/switch-theme
v0.1.3
Published
Easily handle themes in your website
Downloads
1
Readme
switch-theme-js
Easily switch themes in your website
Features
- Themes switch without page reload
- Many more features coming
Live demo
See live demo
Click on "Dark theme" refresh the page, you see the page is default now set to dark theme.
Contributing
You can find the contributing guidelines here
FAQs
These are the frequently asked questions:
1. What happens actually
This is a basic JS code, that stores the theme name in a cookie that stays for 10 days and adds the theme name to the class list of the body.
2. How to design a theme?
You need to know CSS for that.
- Think of a cool theme name
- To select the theme in CSS, use
.theme_name
wheretheme_name
is your theme name - To add a button for user to switch the theme, use the html
a
tag e.g.<a href="javascript:switchTheme('dark', 'white');">Dark theme</a>
- Add
onload="getTheme();"
to yourbody
tag - Add
<script async defer src="https://cdn.jsdelivr.net/gh/PuneetGopinath/switch-theme-js@main/src/switch.js"></script>
in the head tag. - That's all, test it out in your website, or submit a bug report for us to Analyse it.
3. Example html file
The index.html file shows an example.
Supporters
👏 A big thank you goes to all the supporters of this project!
You prove that the switch-theme-js Action has some value for you!
Stargazers
Contributors
Thanks to all contributors again!