Last active
June 11, 2021 06:13
-
-
Save bharat-tiwari/8afc803fcef5618e05fb1691d06915aa to your computer and use it in GitHub Desktop.
index.js importing gitlab package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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