0.1.3 ā€¢ Published 3 years ago

@bkbaalkrshna/switch-theme v0.1.3

Weekly downloads
-
License
LGPL-2.1-only
Repository
github
Last release
3 years ago

switch-theme-js

Easily switch themes in your website

GitHub stars GitHub forks GitHub issues GitHub repo size Lines of code Contributor Covenant

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.

  1. Think of a cool theme name
  2. To select the theme in CSS, use .theme_name where theme_name is your theme name
  3. 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>
  4. Add onload="getTheme();" to your body tag
  5. Add <script async defer src="https://cdn.jsdelivr.net/gh/PuneetGopinath/switch-theme-js@main/src/switch.js"></script> in the head tag.
  6. 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

Stargazers for @PuneetGopinath/switch-theme-js

Contributors

Thanks to all contributors again!

GitHub Contributors Image