changing colors note stem
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 precede Jojo-Schmitz in directing you to: https://musescore.org/en/project/color-notes-each-voice
Check them out.
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.
In reply to I tried looking into the … by Maarten Vandec…
Did you take the plugin from https://musescore.org/en/project/color-notes-each-voice ?
In reply to Did you take the plugin from… 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.
In reply to Yes, I tried. The plugin … by Maarten Vandec…
Guessing, I think you put the 'stem' element in the wrong place. 'Accidental' is a property of the 'note' element, 'Stem' is a property of the 'Chord' element.
In reply to Guessing, I think you put… by ILPEPITO
Ooop I wrote in capital letters words that should have been written in lower case... the hurry!
In reply to Yes, I tried. The plugin … by Maarten Vandec…
copy parts to the 'color notes' plugin
Huh?
In reply to copy parts to the 'color… by Jojo-Schmitz
to clarify: I looked into the colour voices plugin try and understand the code behind it and copied/altered parts, hoping it would solve my issue.
In reply to to clarify: I looked into… by Maarten Vandec…
OK, got it now, I though you were talking of parts in the sense of MuseScore, instrument excerpts
In reply to Yes, I tried. The plugin … by Maarten Vandec…
Hold on, the 'color notes' plugin colors notes depending on their pitch.
And as there are potentially/often more than one note to a chord, coloring the stem doesn't make much sense, except maybe for when there's really only one note to the chord, more the exception than the rule most of the time
In reply to Hold on, the 'color notes'… by Jojo-Schmitz
Fair consideration, but the fact remains that, regardless of the dependence on the pitch, the search for the 'stem' must be placed in the right place. The applicant wants to experiment, as it should be. I wish him a lot of fun...
In reply to Hold on, the 'color notes'… by Jojo-Schmitz
Correct, at the moment I'm not interested in chords, but only single notes. I would like to have everything of a single note in a certain colour, including the line pointing up or down attached to a note (if note value < whole note). I thought that line was called a stem, but maybe I'm using a wrong word?
In reply to Correct, at the moment I'm… by Maarten Vandec…
It is called a stem (Hals in German)
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.
In reply to I realized that the plugin… by ILPEPITO
Coloring the beam would only make sense if all notes under that beam have the same pitch
In reply to Coloring the beam would only… by Jojo-Schmitz
Yes, the same thing i thought... for this reason i left the 'code' (inactive) for this function. You can decide to activate it depending on how the melody is made.
In reply to I realized that the plugin… by ILPEPITO
Thank you!!!