How can I color ties through a plugin?

• Jan 21, 2025 - 22:03

The plugin ColorVoices Master can color the notes. I would like to add the functionality of coloring ties too. How can I do this?


Comments

Where you find this piece of code:

  else if (element.type === Element.NOTE) {
     toggleColor(element, colors[voice % 4])
     if (element.accidental)
        toggleColor(element.accidental, colors[voice % 4])          
     for (var i = 0; i < element.dots.length; i++) {
        if (element.dots[i])
           toggleColor(element.dots[i], colors[voice % 4])
        }
     }

you will have to enter:

  else if (element.type === Element.NOTE) {
     toggleColor(element, colors[voice % 4])
     if (element.accidental)
        toggleColor(element.accidental, colors[voice % 4])
     if (element.tieBack) // ADD THIS
        toggleColor(element.tieBack, colors[voice % 4]) // ADD THIS         
     for (var i = 0; i < element.dots.length; i++) {
        if (element.dots[i])
           toggleColor(element.dots[i], colors[voice % 4])
        }
     }

Obviously it doesn't work with 'slurs'...

Do you still have an unanswered question? Please log in first to post your question.