Modified darkMode default to 'prefers-color-scheme'

pull/231/head
Phantas Weng 4 years ago
parent cce39479ae
commit 3a9c579aa5

@ -87,7 +87,7 @@ new Vue({
**Parameters**|**Type's**|**Default**|**Required**|**Description**
-----|-----|-----|-----|-----
debug|Boolean|`false`|Optional|Enable logging for debug
darkMode|Boolean|`false`|Optional|Enable console dark mode for debug
darkMode|Boolean|prefers-color-scheme|Optional|Enable console dark mode for debug
connection|String/Socket.io-client|`null`|Required|Websocket server url or socket.io-client instance
vuex.store|Vuex|`null`|Optional|Vuex store instance
vuex.actionPrefix|String|`null`|Optional|Prefix for emitting server side vuex actions

File diff suppressed because one or more lines are too long

@ -17,7 +17,7 @@ export default class VueSocketIO {
constructor({connection, vuex, debug, darkMode, options}){
Logger.debug = debug;
Logger.darkMode = darkMode;
Logger.darkMode = darkMode || window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
this.io = this.connect(connection, options);
this.emitter = new Emitter(vuex);
this.listener = new Listener(this.io, this.emitter);

@ -10,7 +10,6 @@ export default new class VueSocketIOLogger {
}
info(text, data = '') {
if(this.debug) {
if (this.darkMode) {
window.console.info(this.prefix+`%c${text}`, 'color: #A9D341; font-weight: 600', 'color: #F7AC15', data);
@ -45,4 +44,4 @@ export default new class VueSocketIOLogger {
}
}
}

Loading…
Cancel
Save