themes: add bitwig theme and manage themes src as scss

This commit is contained in:
jean-emmanuel 2018-03-03 17:37:54 +01:00
parent 086aa09572
commit 46c196992e
11 changed files with 137 additions and 56 deletions

View file

@ -5,7 +5,8 @@ var baseDir = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'
configPath = require('path').join(baseDir, '.open-stage-control'),
fs = require('fs'),
ifaces = require('os').networkInterfaces(),
chokidar = require('chokidar')
chokidar = require('chokidar'),
path = require('path')
var options = {
's':{alias:'send',type:'array',describe:'default targets for all widgets (ip:port pairs)',
@ -111,25 +112,25 @@ var loadTheme = function(themes){
var style = []
for (let i in themes) {
let path = themes[i]
if (!fs.existsSync(path)) {
path = __dirname + '/themes/' + themes[i] + '.css'
if (!fs.existsSync(path)) {
path = false
let file = themes[i]
if (!fs.existsSync(file)) {
file = path.resolve(__dirname + '/../browser/themes/' + themes[i] + '.css')
if (!fs.existsSync(file)) {
file = false
}
}
if (path) {
if (file) {
let updateStyle = (i)=>{
try {
style[i] = fs.readFileSync(path,'utf-8')
style[i] = fs.readFileSync(file,'utf-8')
} catch(err) {
throw err
}
}
let watchFile = ()=>{
var watcher = chokidar.watch(path)
var watcher = chokidar.watch(file)
watcher.on('change',()=>{
updateStyle(i)
require('./callbacks').reloadCss()

View file

@ -1,16 +0,0 @@
:root {
--color-text: rgba(255,255,255,0.7);
--color-text-fade: rgba(255,255,255,0.5);
/*--color-accent:#f58506;*/
--color-bg: #000;
--color-fg: #111;
--color-raised: #1C1C1C;
--color-track: #111;
--color-light: rgba(255,255,255,0.03);
}
.keyboard-container {
--color-black: #555;
}

View file

@ -1,21 +0,0 @@
:root {
--color-text: rgba(0,0,0,0.7);
--color-text-fade: rgba(0,0,0,0.5);
--color-accent:rgba(28, 133, 239, 1);
--color-grid: rgba(28, 133, 239, .1);
--color-bg: #bbb;
--color-fg: #ddd;
--color-raised: #efefef;
--color-track: #dadada;
--color-light: rgba(255,255,255,0.5);
--color-white: black;
}
.keyboard-container {
--color-black-key: #ccc;
--color-white-key: #eee;
}

View file

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

27
scripts/build-css.js Normal file
View file

@ -0,0 +1,27 @@
var sass = require('node-sass'),
path = require('path'),
fs = require('fs')
var indir = path.resolve(__dirname + '/../src/browser/scss/'),
outdir= path.resolve(__dirname + '/../app/browser/')
fs.readdirSync(indir + '/themes/').forEach(file => {
if (file.includes('.scss') && file !== 'default.scss') {
let result = sass.renderSync({
file: indir + '/themes/' + file,
outputStyle: 'compressed'
})
fs.writeFileSync(outdir + '/themes/' + file.split('/').pop().replace('scss', 'css'), result.css)
}
})
var result = sass.renderSync({
file: indir + '/style.scss',
outputStyle: 'compressed'
})
fs.writeFileSync(outdir + '/style.css', result.css)

View file

@ -2,6 +2,7 @@ var WS = require('../app/node_modules/ws')
var ipc = new WS('ws://127.0.0.1:8080/dev')
ipc.on('error', ()=>{})
ipc.on('open', ()=>{
ipc.send('["reloadCss"]')
process.exit()

View file

@ -73,11 +73,11 @@
left:0;
right:0;
bottom:0;
background: radial-gradient(ellipse farthest-side at center top, var(--color-custom), var(--color-track));
background: radial-gradient(ellipse farthest-side at center top, var(--color-glass), var(--color-track));
background-size: 150% 150%;
background-repeat: no-repeat;
background-position: center top;
opacity: .15;
opacity: var(--glass-opacity);
z-index: 3;
}
}

View file

@ -1,6 +1,6 @@
@import 'vars';
@import 'reset';
@import 'themes/default';
@import 'reset';
@import 'scrollbars';

View file

@ -1,7 +1,7 @@
$base: rgb(25, 31, 42);
$accent: rgb(82, 168, 255);
$tone: rgb(104, 174, 245);
$base: #181818;
$accent: #d98533;
$tone: rgb(200, 200, 200);
$text: white;
:root {

View file

@ -0,0 +1,43 @@
$base: rgb(25, 31, 42);
$accent: rgb(82, 168, 255);
$tone: rgb(104, 174, 245);
$text: white;
:root {
////////////////////// COLOR SCHEME
--color-text: transparentize($text, .4);
--color-text-fade: transparentize($text, .6);
--color-accent: $accent;
--color-grid: transparentize($accent, 0.95);
--color-bg: $base;
--color-track: desaturate(mix($base, $tone, 95), 2);
--color-fg: desaturate(mix($base, $tone, 88), 5);
--color-raised: desaturate(mix($base, $tone, 75), 5);
--color-light: desaturate(transparentize($tone, 0.90), 50);
--color-white: white;
////////////////////// AUTO
--color-custom: var(--color-accent);
////////////////////// GLASS EFFET
--color-glass: var(--color-accent);
--glass-opacity: 0.15;
////////////////////// MISC
--nav-height:40rem;
--sidepanel-size:300rem;
--scrollbar-size:20rem;
--grid-width:10;
}

View file

@ -0,0 +1,49 @@
$base: rgb(200, 200, 200);
$accent: rgb(0, 200, 200);
$tone: white;
$text: black;
:root {
////////////////////// COLOR SCHEME
--color-text: transparentize($text, .4);
--color-text-fade: transparentize($text, .6);
--color-accent: $accent;
--color-grid: transparentize($accent, 0.95);
--color-bg: $base;
--color-track: desaturate(mix($base, $tone, 40), 2);
--color-fg: desaturate(mix($base, $tone, 30), 5);
--color-raised: desaturate(mix($base, $tone, 20), 5);
--color-light: desaturate(transparentize($tone, 0.90), 50);
--color-white: white;
////////////////////// AUTO
--color-custom: var(--color-accent);
////////////////////// GLASS EFFET
--color-glass: white;
--glass-opacity: 0.55;
////////////////////// MISC
--nav-height:40rem;
--sidepanel-size:300rem;
--scrollbar-size:20rem;
--grid-width:10;
}
.keyboard-container {
--color-black-key: #333;
--color-white-key: #fff;
}