0xfe / vexflow

A JavaScript library for rendering music notation and guitar tablature.
http://www.vexflow.com
Other
3.83k stars 657 forks source link

Coloring note heads in chords #1614

Open taat opened 2 months ago

taat commented 2 months ago

I can't find a way to change the fill color or add any attributes to a single note within a chord (each note head with of a different color). Is this possible with VexFlow?

I'm rendering a chord like this:

let notes = score.notes('(F4 G#4 C#5)/4', { clef: clef } );

I can even add some custom attributes for a whole group of notes:

let notes = score.notes('(F4 G#4 C#5)/4[id="foobar"]', { clef: clef } );

But how do I change a color or attribute of a just single note (eg. G#4 should be red).

taat commented 2 months ago

False alarm, found it:

                        notes[0].setKeyStyle(1, {fillStyle: "red"});

sorry for the noise.