From edfa8681e350b456dedfd24627c31859c699e4c5 Mon Sep 17 00:00:00 2001 From: tobias <thinkdifferent055@gmail.com> Date: Sat, 7 Oct 2023 11:11:30 +0200 Subject: [PATCH] #187 - Use global design if no pad design exists --- feedbacks.js | 10 ++++++---- project.js | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/feedbacks.js b/feedbacks.js index ba630ce..1ce4ec3 100644 --- a/feedbacks.js +++ b/feedbacks.js @@ -34,14 +34,16 @@ module.exports = async function (self) { if (pad != null) { self.log('debug', `Update feedback for pad id ${pad.id} with status ${pad.status}`); if (pad.status === 'PLAY') { + let design = pad.design.play ?? self.currentProject.getDesign().play; return { - bgcolor: hexStringToNumber(pad.design.play.hi), - color: hexStringToNumber(pad.design.play.font) + bgcolor: hexStringToNumber(design.hi), + color: hexStringToNumber(design.font) }; } else { + let design = pad.design.normal ?? self.currentProject.getDesign().normal; return { - bgcolor: hexStringToNumber(pad.design.normal.hi), - color: hexStringToNumber(pad.design.normal.font) + bgcolor: hexStringToNumber(design.hi), + color: hexStringToNumber(design.font) }; } } else { diff --git a/project.js b/project.js index 603ba84..0f54e19 100644 --- a/project.js +++ b/project.js @@ -107,4 +107,12 @@ module.exports = class Project { } return null } + + /* + Design + */ + + getDesign() { + return this.data.design; + } } \ No newline at end of file -- GitLab