adding custom color support for every widget (using the new css --properties feature)
This commit is contained in:
parent
b6c73c2318
commit
0727114bb0
20 changed files with 45 additions and 38 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ module.exports.options = {
|
|||
width:'auto',
|
||||
height:'auto',
|
||||
horizontal:false,
|
||||
color:'auto',
|
||||
css:'',
|
||||
|
||||
separator2:'behaviour',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ module.exports.options = {
|
|||
top:'auto',
|
||||
width:'auto',
|
||||
height:'auto',
|
||||
color:'auto',
|
||||
css:'',
|
||||
|
||||
separator2:'behaviour',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ module.exports.options = {
|
|||
width:'auto',
|
||||
height:'auto',
|
||||
horizontal:false,
|
||||
color:'auto',
|
||||
css:'',
|
||||
|
||||
separator3:'osc',
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ module.exports.options = {
|
|||
width:'auto',
|
||||
height:'auto',
|
||||
horizontal:false,
|
||||
color:'auto',
|
||||
css:'',
|
||||
|
||||
separator2:'osc',
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue