changing colors note stem

• Jan 27, 2025 - 20:12

Hi all,

I'm using te colornotes plugin to change the colors of the notes, but I would also like to change the colors of the stem and hooks. I tried to alter the code by copying the "note.accidental" part and changing it to "note.stem":

        if (note.accidental) {
              if (note.accidental.color == black)
                    note.accidental.color = colors[note.pitch % 12];
              else
                    note.accidental.color = black;
        }

        if (note.stem) {
              if (note.stem.color == black)
                    note.stem.color = colors[note.pitch % 12];
              else
                    note.stem.color = black;
        }

But this doesn't work.

What am I doing wrong?


Comments

I tried looking into the 'colours of voices' plugin, but somehow it doesn't work. Maybe my question is not very clear (I'm also a bit lost in the official translation of the 'stick' attached to a note). Attached you can find the result of my script, below is what I want to be the result.

Attachment Size
color notes issue.PNG 43.3 KB

In reply to by Jojo-Schmitz

Yes, I tried. The plugin (color voices) itself works like a charm (all notes are in the same color, because it is the same voice), but somehow it doesn't work if I try to copy parts to the 'color notes' plugin. I must say it is my first try in modifying musescore plugins, so probably I'm missing some easy steps.

I'm now looking into a way to add some logging to see if I can't find the mistake.

I realized that the plugin you refer to is part of the standard Musescore equipment, and i had fun modifying it. Now also color 'stem' and 'hook': but not the 'beam' because it really wouldn't make sense (even if i left the code to be able to do this too). I publish it here in attachment: a few changes were enough.

Attachment Size
colornotesandstems.qml 6.02 KB

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