use hap color for claviature

This commit is contained in:
Felix Roos 2024-03-15 00:39:31 +01:00
parent 708675077f
commit 094b30cd26
2 changed files with 3 additions and 5 deletions

View file

@ -37,14 +37,14 @@ registerWidget('claviature', 'strudel-claviature');
Pattern.prototype.claviature = function (id, options = {}) {
return this.onFrame((haps) => {
const keys = haps.map((h) => h.value.note);
const colorize = haps.map((h) => ({ keys: [h.value.note], color: h.context?.color || 'steelblue' }));
let el = document.getElementById(id);
el?.setAttribute(
'options',
JSON.stringify({
...options,
range: options.range || ['A2', 'C6'],
colorize: [{ keys: keys, color: options.color || 'steelblue' }],
colorize,
}),
);
});