terminal: colorize debug messages for in/out messages

This commit is contained in:
jean-emmanuel 2022-11-09 09:22:53 +01:00
parent aea55d45ca
commit c7ce398632
5 changed files with 19 additions and 5 deletions

View file

@ -11,6 +11,7 @@
- misc
- change noFocus client option behavior: the defalt client window now doesn't take the focus at all, even when a text input is clicked.
- colorize debug messages for in/out messages
- scripting
- add `setFocusable()` function to change the focusability of the window on the fly (allows reenabling focus temporarely to interact with a text widget using a dedicated toggle button for example)

View file

@ -2,6 +2,11 @@ var {ipcRenderer} = require('electron'),
ansiHTML = require('ansi-html'),
html = require('nanohtml')
ansiHTML.setColors({
magenta: 'B48EAD',
cyan: '81A1C1',
})
class Terminal {
constructor(options) {

View file

@ -171,7 +171,7 @@ osc-settings-checkbox, osc-settings-reset, osc-settings-file {
cursor: auto;
> div {
margin: 0 12rem 4rem;
margin: 0 12rem;
}
@ -180,7 +180,9 @@ osc-settings-checkbox, osc-settings-reset, osc-settings-file {
cursor: auto;
white-space: pre-wrap;
}
.log span {
background: transparent!important
}
.help {
font-style: italic;
color: var(--color-accent);

View file

@ -109,7 +109,13 @@ class MidiConverter {
console.log(data)
}
} else if (name == 'debug') {
console.log('(DEBUG, MIDI) ' + data)
if (data.indexOf('in:') === 0) {
console.log('\x1b[36m(DEBUG, MIDI)', data, '\x1b[0m')
} else if (data.indexOf('out:') === 0) {
console.log('\x1b[35m(DEBUG, MIDI)', data, '\x1b[0m')
} else {
console.log('(DEBUG, MIDI) ' + data)
}
} else if (name == 'osc') {
instance.receiveOsc(data)
} else if (name == 'error') {

View file

@ -118,7 +118,7 @@ class OscServer {
}
if (debug) console.log('(DEBUG, OSC) Out: ',{address:data.address, args: data.args}, 'To: ' + data.host + ':' + data.port)
if (debug) console.log('\x1b[35m(DEBUG, OSC) Out: ',{address:data.address, args: data.args}, 'To: ' + data.host + ':' + data.port, '\x1b[0m')
}
@ -137,7 +137,7 @@ class OscServer {
ipc.send('receiveOsc', data, clientId)
if (debug) console.log('(DEBUG, OSC) In: ', {address:data.address, args: data.args}, 'From: ' + data.host + ':' + data.port)
if (debug) console.log('\x1b[36m(DEBUG, OSC) In: ', {address:data.address, args: data.args}, 'From: ' + data.host + ':' + data.port, '\x1b[0m')
}