mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-16 10:06:54 +00:00
Get a basic gray theme set up.
This commit is contained in:
parent
ca0b6b5478
commit
1e9953a0a8
2 changed files with 2804 additions and 33 deletions
|
@ -7,7 +7,7 @@
|
|||
import Module from 'utilities/module';
|
||||
import {createElement as e} from 'utilities/dom';
|
||||
|
||||
import THEME_CSS_URL from 'styles/theme.scss';
|
||||
import THEME_CSS_URL from 'site/styles/theme.scss';
|
||||
|
||||
|
||||
export default class ThemeEngine extends Module {
|
||||
|
@ -18,24 +18,22 @@ export default class ThemeEngine extends Module {
|
|||
|
||||
this.should_enable = true;
|
||||
|
||||
/*this.settings.add('theme.dark', {
|
||||
this.settings.add('theme.dark', {
|
||||
requires: ['context.ui.theme'],
|
||||
default: false,
|
||||
process(ctx, val) {
|
||||
return ctx.get('context.ui.theme') === 1 ? val : false
|
||||
},
|
||||
|
||||
ui: {
|
||||
path_tokens: [
|
||||
{
|
||||
title: 'Appearance',
|
||||
description: 'Personalize the appearance of Twitch. Change the color scheme and fonts and tune the layout to optimize your experience.'
|
||||
},
|
||||
'Theme',
|
||||
{key: 'tabs', page: true},
|
||||
{title: 'General', tab: true}
|
||||
],
|
||||
|
||||
title: 'Dark Mode',
|
||||
path: 'Appearance @{"description": "Personalize the appearance of Twitch. Change the color scheme and fonts and tune the layout to optimize your experience."} > Theme >> General',
|
||||
title: 'Gray (no Purple)',
|
||||
description: '<em>Requires Dark Theme to be Enabled.</em><br>I see my website and I want it painted black...<br>This is a very early feature and will change as there is time.',
|
||||
component: 'setting-check-box'
|
||||
}
|
||||
});*/
|
||||
},
|
||||
|
||||
changed: val => this.updateSetting(val)
|
||||
});
|
||||
|
||||
this.settings.add('theme.is-dark', {
|
||||
requires: ['context.ui.theme'],
|
||||
|
@ -47,29 +45,34 @@ export default class ThemeEngine extends Module {
|
|||
this._style = null;
|
||||
}
|
||||
|
||||
onLoad() {
|
||||
toggleStyle(enable) {
|
||||
if ( ! this._style ) {
|
||||
if ( ! enable )
|
||||
return;
|
||||
|
||||
this._style = e('link', {
|
||||
rel: 'stylesheet',
|
||||
type: 'text/css',
|
||||
href: THEME_CSS_URL
|
||||
});
|
||||
|
||||
} else if ( ! enable ) {
|
||||
if ( this._style.parentElement === document.head )
|
||||
document.head.removeChild(this._style);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
document.head.appendChild(this._style);
|
||||
}
|
||||
|
||||
onUnload() {
|
||||
document.head.removeChild(this._style);
|
||||
this._style = null;
|
||||
updateSetting(enable) {
|
||||
console.log('update-setting', enable);
|
||||
this.toggleStyle(enable);
|
||||
document.body.classList.toggle('theme--ffz', enable);
|
||||
}
|
||||
|
||||
/*onEnable() {
|
||||
//document.querySelector('[data-reactroot]').classList.add('theme--ffz');
|
||||
|
||||
//this._update_dark_mode();
|
||||
//this.settings.on(':changed:theme.dark', this._update_dark_mode, this);
|
||||
onEnable() {
|
||||
this.updateSetting(this.settings.get('theme.dark'));
|
||||
}
|
||||
|
||||
_update_dark_mode() {
|
||||
document.querySelector('[data-reactroot]').classList.toggle('theme--dark', this.settings.get('theme.dark'));
|
||||
}*/
|
||||
}
|
2768
src/sites/twitch-twilight/styles/theme.scss
Normal file
2768
src/sites/twitch-twilight/styles/theme.scss
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue