adding custom color support for every widget (using the new css --properties feature)

This commit is contained in:
jean-emmanuel 2016-03-20 18:42:08 +01:00
parent b6c73c2318
commit 0727114bb0
20 changed files with 45 additions and 38 deletions

View file

@ -148,6 +148,8 @@ module.exports.widgets = function(data,parent) {
// create widget
var widgetInner = createWidget[widgetData.type](widgetData,widgetContainer)
if (widgetData.color && widgetData.color!='auto') widgetInner[0].style.setProperty('--color-accent',widgetData.color)
widgetContainer.append(widgetInner)
// store widget reference for cross widget sync

View file

@ -18,6 +18,7 @@ module.exports.options = {
width:'auto',
height:'auto',
horizontal:false,
color:'auto',
css:'',
separator2:'behaviour',

View file

@ -16,6 +16,7 @@ module.exports.options = {
top:'auto',
width:'auto',
height:'auto',
color:'auto',
css:'',
separator2:'behaviour',

View file

@ -16,6 +16,7 @@ module.exports.options = {
width:'auto',
height:'auto',
horizontal:false,
color:'auto',
css:'',
separator3:'osc',

View file

@ -14,6 +14,7 @@ module.exports.options = {
top:'auto',
width:'auto',
height:'auto',
color:'auto',
css:'',
@ -44,6 +45,7 @@ module.exports.create = function(widgetData,container) {
id: widgetData.id + '_' + i,
label:i,
horizontal:false,
color:widgetData.color,
absolute:true,
range:widgetData.range,
logScale:widgetData.logScale,

View file

@ -13,6 +13,7 @@ module.exports.options = {
top:'auto',
width:'auto',
height:'auto',
color:'auto',
css:'',
separator2:'osc',
@ -34,12 +35,13 @@ module.exports.create = function(widgetData,container) {
$document = $(document)
widget.value = []
for (var i=0;i<widgetData.matrix[0]*widgetData.matrix[1];i++) {
var data = {
type:'push',
id: widgetData.id + '_' + i,
label:i,
color:widgetData.color,
on:widgetData.on,
off:widgetData.off,
precision:widgetData.precision,

View file

@ -13,6 +13,7 @@ module.exports.options = {
top:'auto',
width:'auto',
height:'auto',
color:'auto',
css:'',
separator2:'osc',
@ -40,6 +41,7 @@ module.exports.create = function(widgetData,container) {
type:'toggle',
id: widgetData.id + '_' + i,
label:i,
color:widgetData.color,
on:widgetData.on,
off:widgetData.off,
precision:widgetData.precision,

View file

@ -12,6 +12,7 @@ module.exports.options = {
top:'auto',
width:'auto',
height:'auto',
color:'auto',
css:'',
separator2:'plot',
@ -42,7 +43,6 @@ module.exports.create = function(widgetData,container) {
widget.width = undefined
widget.linkedWidgets = []
widget.visible = false
widget.lineColor = String(getComputedStyle(document.documentElement).getPropertyValue("--color-accent")).trim()
widget.textColor = String(getComputedStyle(document.documentElement).getPropertyValue("--color-text-fade")).trim()
widget.pips = {
x : {
@ -82,8 +82,10 @@ module.exports.create = function(widgetData,container) {
if (!self.visible) {
widget.visible = true
canvas.addClass('visible')
widget.lineColor = String(getComputedStyle(widget[0]).getPropertyValue("--color-accent")).trim()
}
widget.height=height
widget.width=width

View file

@ -36,8 +36,6 @@ module.exports.create = function(widgetData,container) {
widget.value = widget.find('span')
if (widgetData.color!='auto') light.setAttribute('style',`background:${widgetData.color}`)
widget.on('drag',function(e){e.stopPropagation()})
widget.on('draginit.push',function(){
widget.off('draginit.push')

View file

@ -13,6 +13,7 @@ module.exports.options = {
width:'auto',
height:'auto',
horizontal:false,
color:'auto',
css:'',
separator2:'osc',

View file

@ -35,8 +35,6 @@ module.exports.create = function(widgetData,container) {
widget.value = widget.find('span')
if (widgetData.color!='auto') light.setAttribute('style',`background:${widgetData.color}`)
widget.on('drag',function(e){e.stopPropagation()})
widget.on('draginit.toggle',function(){
widget.off('draginit.toggle')

View file

@ -13,6 +13,7 @@ module.exports.options = {
top:'auto',
width:'auto',
height:'auto',
color:'auto',
css:'',
separator2:'plot',
@ -39,7 +40,6 @@ module.exports.create = function(widgetData,container) {
widget.height = 0
widget.width = 0
widget.visible = false
widget.lineColor = String(getComputedStyle(document.documentElement).getPropertyValue("--color-accent")).trim()
widget.textColor = String(getComputedStyle(document.documentElement).getPropertyValue("--color-text-fade")).trim()
widget.pips = {
min: Math.abs(widgetData.range.min)>=1000?widgetData.range.min/1000+'k':widgetData.range.min,
@ -57,6 +57,7 @@ module.exports.create = function(widgetData,container) {
if (!self.visible) {
widget.visible = true
canvas.addClass('visible')
widget.lineColor = String(getComputedStyle(widget[0]).getPropertyValue("--color-accent")).trim()
}
widget.height=height