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

File diff suppressed because one or more lines are too long

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

View file

@ -2,6 +2,7 @@
width:100rem;
min-height: 200rem;
height:100%;
&.nolabel .fader-wrapper-outer {
top:0;
}
@ -53,7 +54,7 @@
transform-origin: bottom;
max-height:100%;
max-width:100%;
background:$color-accent;
background:var(--color-accent);
z-index: 3;
transform-style: preserve-3d;
backface-visibility: hidden;
@ -73,10 +74,9 @@
left:-2rem;
height:8rem;
width:8rem;
background:$color-accent;
background:var(--color-accent);
border:none!important;
border-radius: 100%!important;
box-shadow: 0 0 0 6rem transparentize($color-accent,.8),0 0 2rem 0 mix($color-text,$color-fg,2);
}
span:after {
content:"";
@ -87,7 +87,8 @@
width:20rem;
border:none!important;
border-radius: 100%!important;
box-shadow: 0 0 0 1rem transparentize($color-accent,.8) inset;
background:var(--color-accent);
opacity: .2;
}
}
.meter-container {

View file

@ -68,7 +68,7 @@
.knob:after {
border-color: $color-track;
border-left-color: $color-accent;
border-top-color: $color-accent;
border-top-color: var(--color-accent);
}
}
&.pan-right {
@ -79,8 +79,8 @@
}
.knob:after {
border-color: $color-track;
border-right-color: $color-accent;
border-bottom-color: $color-accent;
border-right-color: var(--color-accent);
border-bottom-color: var(--color-accent);
}
}
@ -125,15 +125,15 @@
bottom:0;
border-radius:100%;
border:4rem solid $color-track;
border-bottom-color: $color-accent;
border-bottom-color: var(--color-accent);
}
&.d2:after {
border-right-color: $color-accent;
border-right-color: var(--color-accent);
}
&.d3:after {
border-top-color: $color-accent;
border-right-color: $color-accent;
border-top-color: var(--color-accent);
border-right-color: var(--color-accent);
}
@ -156,10 +156,9 @@
margin-top:-4rem;
height:8rem;
width:8rem;
background:$color-accent;
background:var(--color-accent);
border:none!important;
border-radius: 100%!important;
box-shadow: 0 0 0 6rem transparentize($color-accent,.8),0 0 2rem 0 mix($color-text,$color-fg,2);
}
&:after {
content:"";
@ -171,7 +170,8 @@
width:20rem;
border:none!important;
border-radius: 100%!important;
box-shadow: 0 0 0 1rem transparentize($color-accent,.8) inset;
background:var(--color-accent);
opacity: .2;
}
}
.pip {

View file

@ -60,10 +60,9 @@
right:-4rem;
height:8rem;
width:8rem;
background:$color-accent;
background:var(--color-accent);
border:none!important;
border-radius: 100%!important;
box-shadow: 0 0 0 6rem transparentize($color-accent,.8),0 0 2rem 0 mix($color-text,$color-fg,2);
}
&:after {
content:"";
@ -74,8 +73,8 @@
width:20rem;
border:none!important;
border-radius: 100%!important;
box-shadow: 0 0 0 1rem transparentize($color-accent,.8) inset;
}
background:var(--color-accent);
opacity: .2; }
}
}
@ -123,7 +122,6 @@
background:$color-text;
border:none!important;
border-radius: 100%!important;
box-shadow: 0 0 0 6rem transparentize($color-text,.8)
}
&:after {
content:"";
@ -134,7 +132,7 @@
width:20rem;
border:none!important;
border-radius: 100%!important;
box-shadow: 0 0 0 1rem transparentize($color-text,.8) inset;
background:$color-text;
}
}
}

View file

@ -19,7 +19,7 @@
span {
height:100%;
display:block;
background-color:$color-accent;
background-color:var(--color-accent);
}
}
}
@ -73,7 +73,7 @@
transform-origin: bottom;
max-height:100%;
max-width:100%;
background:$color-accent;
background:var(--color-accent);
&.horizontal {
transform-origin: left;
}

View file

@ -28,20 +28,17 @@
.push {
&.on {
animation:none;
background: $color-accent;
background: $color-fg;
}
border-bottom:4rem solid $color-fg;
.light {
position: absolute;
left:auto;
background: transparent;
background: var(--color-accent);
height:4rem;
width:4rem;
border-radius: 4rem;
&:after {
content: none;
}
overflow: hidden;
}
}
}

View file

@ -71,7 +71,7 @@
border-radius: 8rem;
}
&.on:before {
background: $color-accent;
background: var(--color-accent);
}
}

View file

@ -38,7 +38,7 @@
top:4rem;
height:4rem;
pointer-events: none;
background: $color-accent;
background: var(--color-accent);
&:after {
content:"";
width: 100%;