serkodev/themes.js

Feature request: Add a custom storageKey option

itsezc opened this issue · 0 comments

Currently the storageKey (for localStorage) is hard coded to theme, and this might not be flexible enough for apps where state management solutions and other scripts are often used in conjuction with themes.js.

I propose a new config setup for the initalization:

From (this will still work)

const themes = new Themes('ocean');

To

const themes = new Themes({
  theme: 'ocean',
  storageKey: 'theme',
});

Where the storageKey can be provided as an option for the constructor, or it defaults to theme, however if a string is provided to the constructor, then existing behaviour is to be expected.