allow multiple themes

This commit is contained in:
jean-emmanuel 2016-03-22 13:12:24 +01:00
parent 4d31ce742b
commit 73f482b3e0
4 changed files with 25 additions and 8 deletions

View file

@ -37,9 +37,9 @@ Options:
-l, --load session file to load
-p, --port osc input port (for synchronization)
-n, --nogui disable default gui and makes the app availabe through http on specified port
-t, --theme theme name (light) or path to theme file
-t, --theme theme name or path (mutliple values allowed)
Exemples :
Exemples:
$ open-stage-control -s 127.0.0.1:5555 127.0.0.1:6666 -p 7777
@ -49,6 +49,15 @@ $ open-stage-control -n 8080 -l path/to/session.js
This will create a headless app available through http on port 8080. Multiple clients can use the app (with chrome only) simultaneously, their widgets will be synchronized.
$ open-stage-control -t light noinput /path/to/custom_theme.css
This will apply three themes (light ui, remove all inputs, and a custom theme file)
Available themes:
- light
- noinput
```
### Documentation

View file

@ -81,8 +81,9 @@ module.exports = {
applyStyle: function(event,data){
var data = data || event
console.log(data)
var style = document.createElement('style');
style.innerHTML = data;
style.innerHTML = data.join('');
document.body.appendChild(style);
if (data.indexOf('--pixel-scale')!=-1) {
PXSCALE = data.match(/--pixel-scale\s*:\s*([^;]*)/)[1]

View file

@ -11,7 +11,7 @@ var argv = require('yargs')
'l':{alias:'load',type:'string',describe:'session file to load'},
'p':{alias:'port',describe:'osc input port (for synchronization)'},
'n':{alias:'nogui',describe:'disable default gui and makes the app availabe through http on specified port'},
't':{alias:'theme',type:'string',describe:'theme name or file'}
't':{alias:'theme',type:'array',describe:'theme name or path (mutliple values allowed)'}
})
.check(function(a,x){if(a.port==undefined || !isNaN(a.p)&&a.p>1023&&parseInt(a.p)===a.p){return true}else{throw 'Error: Port must be an integer >= 1024'}})
.check(function(a,x){if(a.n==undefined || !isNaN(a.n)&&a.n>1023&&parseInt(a.n)===a.n){return true}else{throw 'Error: Port must be an integer >= 1024'}})
@ -33,13 +33,17 @@ module.exports = function(fs) {
noGui: argv.n || false,
theme: function(){
if (!argv.t) return
try {return fs.readFileSync(__dirname + '/themes/' + argv.t + '.css','utf-8')}
catch(err) {
try {return fs.readFileSync(argv.t,'utf-8')}
var style = []
for (i in argv.t) {
try {style.push(fs.readFileSync(__dirname + '/themes/' + argv.t[i] + '.css','utf-8'))}
catch(err) {
return
try {style.push(fs.readFileSync(argv.t[i],'utf-8'))}
catch(err) {
continue
}
}
}
return style
}()
}
return {

3
main/themes/noinput.css Normal file
View file

@ -0,0 +1,3 @@
.widget .input {
display: none;
}