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
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,8 @@ module.exports = async function (self) {
self.setFeedbackDefinitions({
PadStatus: {
name: 'Pad Status',
type: 'boolean',
type: 'advanced',
label: 'Pad Status',
defaultStyle: {
bgcolor: combineRgb(255, 0, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'name',
......@@ -23,11 +19,27 @@ module.exports = async function (self) {
const pad = self.currentProject.findPadByName(feedback.options.name);
if (pad != null) {
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 {
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 {
handleMessage(plugin, 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