All Projects → WendellAdriel → css-theme-manager

WendellAdriel / css-theme-manager

Licence: MIT license
Zero dependency lib to manage CSS themes easily for your app

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to css-theme-manager

Create Mui Theme
online tool for creating material-ui themes
Stars: ✭ 80 (+400%)
Mutual labels:  themes, theming
Theme Specification
A specification for defining theme objects & design tokens for use with UI components
Stars: ✭ 374 (+2237.5%)
Mutual labels:  themes, theming
create-material-ui-app
create-react-app + storybook + storybook-addon-material-ui
Stars: ✭ 55 (+243.75%)
Mutual labels:  themes, theming
NumericUpDownLib
Implements numeric up down WPF controls to edit/display values (byte, integer, short, ushort etc.) with a textbox and optional up/down arrow (repeat) buttons. Value editing is possible by dragging the mouse vertically/horizontally, clicking up/down buttons, using up/down or left right cursor keys, spinning mousewheel on mouseover, or editing th…
Stars: ✭ 68 (+325%)
Mutual labels:  themes, theming
semantic-ui-forest
[Archived] Source code for official semantic-ui-forest website.
Stars: ✭ 49 (+206.25%)
Mutual labels:  themes
sqstorage
A easy to use and quick way to organize your inventory, storages and storage areas
Stars: ✭ 18 (+12.5%)
Mutual labels:  management
event-store-mgmt-ui
Event Store Management UI
Stars: ✭ 23 (+43.75%)
Mutual labels:  management
colorcli
Collection of harmonized, light command-line interface (CLI) color themes for tmux, cmus, newsboat, mcabber, Vim, Vifm, and Mutt.
Stars: ✭ 40 (+150%)
Mutual labels:  themes
Krypton-Toolkit-Suite-NET-Core
A update to Component factory's krypton toolkit to support .NET Framework 3.5 to .NET Core
Stars: ✭ 27 (+68.75%)
Mutual labels:  themes
chronoman
Utility class to simplify use of timers created by setTimeout
Stars: ✭ 15 (-6.25%)
Mutual labels:  management
vueman.ga
Delightful reading and tracking of your mangas.
Stars: ✭ 32 (+100%)
Mutual labels:  management
ui-react
ui-react-docs.kibalabs.com/
Stars: ✭ 18 (+12.5%)
Mutual labels:  theming
entrepot
A list of free GitHub.com hosted WordPress plugins, themes & blocks
Stars: ✭ 29 (+81.25%)
Mutual labels:  themes
mohusman360.github.io
Simple Resume Template with Tailwind CSS
Stars: ✭ 38 (+137.5%)
Mutual labels:  themes
ClearVision-v6
Highly customizable theme for BetterDiscord.
Stars: ✭ 248 (+1450%)
Mutual labels:  themes
doki-theme-web
Cute anime character themes for your Chrome, Edge, & Brave browser.
Stars: ✭ 97 (+506.25%)
Mutual labels:  themes
Xresources-themes
A big (huge) collection of rxvt / xterm terminal themes
Stars: ✭ 247 (+1443.75%)
Mutual labels:  themes
RedditWallpaperBot
A Bot for Reddit that gets top Hot sorted picture from a given Subreddit and sets it as background.
Stars: ✭ 15 (-6.25%)
Mutual labels:  themes
slate-cli
This repo has been deprecated. Please open any new issues or PRs in the Shopify/slate repo.
Stars: ✭ 19 (+18.75%)
Mutual labels:  themes
SciFi Conky HUD
SciFi theme for Conky
Stars: ✭ 33 (+106.25%)
Mutual labels:  themes

CSS Theme Manager

license All Contributors

version downloads size gzip size

Watch on GitHub Star on GitHub Tweet

Zero dependency lib to manage CSS themes easily for your app

How to use

Install the package

npm install css-theme-manager --save
// or with yarn
yarn add css-theme-manager

Import it and init the CSS Theme Manager with a default theme. A theme is an object with the name of your variables as keys and the value of the variables as the values.

import CSSThemeManager from 'css-theme-manager'

const themeManager = new CSSThemeManager({
  'bg-color': '#fff',
  'text-color': 'darkblue',
  'featured-font': 'Verdana, sans-serif'
})

This will create and insert the given variables in the :root selector. All the variables created with this CSS Theme Manager will have a csstm- prefix. The code above will result in:

:root {
    --csstm-bg-color: '#fff';
    --csstm-text-color: 'darkblue';
    --csstm-featured-font: 'Verdana, sans-serif';
}

Check the API Reference below to check all that you can do with this package.

API Reference

createTheme(name: String, config: Object)

Creates and registers a new theme with the given name and config.

// import and init the themeManager
// ...
themeManager.createTheme('dark', {
  'bg-color': '#222',
  'text-color': '#ddd'
})

applyTheme(selector: String, theme: String)

Applies the given theme to all elements matching the given selector. You can pass any selector you would pass to the document.querySelectorAll function.

// import and init the themeManager
// ...
themeManager.createTheme('dark', {
  'bg-color': '#222',
  'text-color': '#ddd'
})

themeManager.applyTheme('html', 'dark')

removeTheme(theme: String)

Removes and unregisters the given theme.

// import and init the themeManager
// ...
themeManager.createTheme('dark', {
  'bg-color': '#222',
  'text-color': '#ddd'
})

themeManager.applyTheme('html', 'dark')
themeManager.removeTheme('dark')

Example

You can find an example on how to work with this lib in this CodeSandbox.

Contributors

Thanks goes to these wonderful people (emoji key):


Wendell Adriel

💻 📖 💡 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].