Skip to content

Instantly share code, notes, and snippets.

@bharat-tiwari
Last active June 11, 2021 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bharat-tiwari/8afc803fcef5618e05fb1691d06915aa to your computer and use it in GitHub Desktop.
Save bharat-tiwari/8afc803fcef5618e05fb1691d06915aa to your computer and use it in GitHub Desktop.
index.js importing gitlab package
import { orgThemes } from '@btiwari-gitlab/app-themes';
const applyTheme = theme => {
const body = document.querySelector('body');
const info = document.querySelector('#info');
body.style.background = orgThemes[theme].background;
body.style.color = orgThemes[theme].text;
info.innerText = theme.toUpperCase();
}
const setOnClick = () => {
const darkThemeButton = document.querySelector('#dark');
const lightThemeButton = document.querySelector('#light');
// onclick for Apply Dark Theme button
darkThemeButton.onclick = () => applyTheme('dark');
// onclick for Apply Light Theme button
lightThemeButton.onclick = () => applyTheme('light');
};
setOnClick();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment