Hi Carren, Am 01.07.25 um 23:29 schrieb Carren Carlsen:
I have an unusual question. I am working on a special project and I need to color code key signatures in a specific way. For example: Key D the sharp for F will be blue and the sharp for C will be green. Is this possible to accomplish?
You mean the accidentals in the key signature at the start of the line, right? (As opposed to individual accidentals attached to notes.)
This is possible, but not completely trivial. This is because the key signature (technically: the stencil for the KeySignature grob) is created in the C++ part of LilyPond (i.e. the part that is not accessible to user-side tweaks) as one complete entity. So I see two possibilities:
1) Recreate the machinery drawing the key signature grob in Scheme (absolutely possible, but a bit of work), then (trivially) implementing a color choince along the way.
2) Let LilyPond create the key signature as usual, then crack open the finished stencil, identify its individual accidentals, colourise them at will and recombine them. This is actually not difficult, but it is definitely a hack, since it depends on the KeySignature stencil being constructed the way LilyPond does now (which might change in the future).
I don't see another possibility. But I'm willing to implement 2) if it fits your need.
Do you have an idea for a user interface, i.e. in which way would you like to specify which accidental get which colour?
Best Lukas
