dynamic-theme-switcher

1.0.2 • Public • Published

dynamic-theme-switcher

A JavaScript library for dynamically switching themes in web applications.

Installation

You can install the library via npm:

npm install dynamic-theme-switcher

Usage

import ThemeSwitcher from 'dynamic-theme-switcher';

// Initialize the theme switcher with the default theme
ThemeSwitcher.init(defaultTheme);

// Switch to a new theme
ThemeSwitcher.switchTheme(newTheme);

API

init(defaultTheme: Object)

Initialize the theme switcher with the default theme.

  • defaultTheme: An object containing the default theme variables.

switchTheme(themeVariables: Object)

Switch to a new theme.

  • themeVariables: An object containing the new theme variables.

Example

import ThemeSwitcher from 'dynamic-theme-switcher';

const defaultTheme = {
  primaryColor: '#007bff',
  secondaryColor: '#6c757d',
};

ThemeSwitcher.init(defaultTheme);

const darkTheme = {
  primaryColor: '#343a40',
  secondaryColor: '#6c757d',
};

ThemeSwitcher.switchTheme(darkTheme);

License

This project is licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i dynamic-theme-switcher

Weekly Downloads

6

Version

1.0.2

License

ISC

Unpacked Size

4.07 kB

Total Files

5

Last publish

Collaborators

  • timr76