1.0.3 • Published 4 years ago

tuntum v1.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Tuntum.js

A light weight JavaScript Library that helps you switch/toggle from Light Theme to Dark theme on a web page.

Library capabilities 1. It takes two CSS files thus the light theme CSS and the dark theme CSS 2. It persists or stores the preferred theme of the user/client browser 3. Automatically selects the appropriate theme based on the systems preference

How to Install


It is very simple to add the Tuntum.js to your application.

You can install this from npm by running this command:

    npm i tuntum --save

You can now add this your index.html file or any other file.

    <script src='tuntum.js'> </script>
   // Default option
   let options = {
        isDark: true,
        isLight: false,
        lightPath: "./fitaa.css",
        darkPath: "./tuntum.css",
        saveState: false
    };
    
    //Instantiate the Tuntum class
    let tuntum = new Tuntum(options);
    tuntum.build();

Framework


List of parameters in options object and the

ParameterDefinition
isDarkSets the default state as Dark theme
isLightSets the default state as Light theme
lightPathSpecifies the path to the light CSS file
darkPathSpecifies the path to the dark CSS file
saveStateSaves the selected state in localstorage

List of functions on the tuntum class

FunctionDefinition
setCurrentThemeState()Sets the current theme state (light/dark) selected
getCurrentThemeState()Provides the current theme state
setPersistedThemeState()Sets the theme state to persist
getPersistedThemeState()Get the persisted them state
destroyPersistedThemeState()Clear the persisted state

Todo


  1. Switch theme state based on the startTime and endTime
  2. Automatically re-theme a web page from a single stylesheet
1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago