Skip to content
Snippets Groups Projects
Commit 3b200827 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

#187 - Use pad colors for feedback

parent 96d14d42
Branches
Tags
No related merge requests found
...@@ -4,12 +4,8 @@ module.exports = async function (self) { ...@@ -4,12 +4,8 @@ module.exports = async function (self) {
self.setFeedbackDefinitions({ self.setFeedbackDefinitions({
PadStatus: { PadStatus: {
name: 'Pad Status', name: 'Pad Status',
type: 'boolean', type: 'advanced',
label: 'Pad Status', label: 'Pad Status',
defaultStyle: {
bgcolor: combineRgb(255, 0, 0),
color: combineRgb(0, 0, 0),
},
options: [ options: [
{ {
id: 'name', id: 'name',
...@@ -23,11 +19,27 @@ module.exports = async function (self) { ...@@ -23,11 +19,27 @@ module.exports = async function (self) {
const pad = self.currentProject.findPadByName(feedback.options.name); const pad = self.currentProject.findPadByName(feedback.options.name);
if (pad != null) { if (pad != null) {
self.log('debug', `Update feedback for pad id ${pad.id} with status ${pad.status}`); self.log('debug', `Update feedback for pad id ${pad.id} with status ${pad.status}`);
return pad.status === 'PLAY'; if (pad.status === 'PLAY') {
return {
bgcolor: hexStringToNumber(pad.design.play.hi),
color: hexStringToNumber(pad.design.play.font)
};
} else {
return {
bgcolor: hexStringToNumber(pad.design.normal.hi),
color: hexStringToNumber(pad.design.normal.font)
};
}
} else { } else {
return false; return {
bgcolor: combineRgb(0, 0, 0)
};
} }
}, },
}, },
}) })
} }
function hexStringToNumber(string) {
return parseInt(string.replace(/^#/, ''), 16)
}
...@@ -5,5 +5,6 @@ module.exports = class ProjectUpdate extends MessageExecutable { ...@@ -5,5 +5,6 @@ module.exports = class ProjectUpdate extends MessageExecutable {
handleMessage(plugin, message) { handleMessage(plugin, message) {
plugin.currentProject = new Project(message) plugin.currentProject = new Project(message)
plugin.checkFeedbacks();
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment