-
-
Save lucasvanhalst/35dcffa5cbfd704825debc4e83a2e30f to your computer and use it in GitHub Desktop.
Rocketchat night theme
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
var iconNightMode = document.createElement('i'); | |
iconNightMode.className='icon-toggle-off'; | |
var btnNightMode = document.createElement('div'); | |
btnNightMode.className="tab-button"; | |
btnNightMode.id = 'toggle-nightmode'; | |
btnNightMode.title = 'Toggle night mode'; | |
btnNightMode.appendChild(iconNightMode) | |
$('.flex-tab-bar').append(btnNightMode) | |
var rocketChatContainer = $('#rocket-chat'); | |
rocketChatContainer.toggleClass('theme-night', !!JSON.parse(localStorage.getItem('nightmode'))); | |
$('#toggle-nightmode').unbind('click').click(function(){ | |
var $this = $(this); | |
rocketChatContainer.toggleClass('theme-night'); | |
var isNight = rocketChatContainer.hasClass('theme-night') | |
$this.find('i').toggleClass('icon-toggle-on', isNight).toggleClass('icon-toggle-off', !isNight); | |
localStorage.setItem('nightmode', isNight); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment