-
Notifications
You must be signed in to change notification settings - Fork 215
Description
Motivation
There were repeating requests to allow "coloring of notes" from different users. Only a few users reported concrete use-cases on what exactly should be colored, how, and for what purpose. The use case makes sense but to ship the correct coloring of elements is not an easy task. The goal on the most recent request here is that individual notes should be colored for a music theory app. Coloring the notes allows referencing them in the descriptions like "the red note is a C"
Challenge
Here a very extreme case of notation elements related to a note. This should help understanding why "coloring a note" is more complex than initially expected. In this screenshot we see only 2 notes:
On the first beat:
- We have Tabs, Standard notation, slash notation and numbered notation displayed.
- The two notes have their own note heads.
- The two notes share a stem and the bar to the next note.
- Before the notes we have an accidental, fingering and a arpeggio effect arrow
- After the notes we have duration dots.
- Below the notes we have an accentuation.
- The stem has a tremolo picking bar.
- Above the beat we have a upper mordent symbol
- One of the notes has a slide line and tie/slur to the next note
Hence adding a single color property to notes or beats will not serve many use cases but rather only a very specific one.
Proposed Solution
By default the colors of the renderingResources
still apply but on different levels of the Score
model, users can specify colors for specific notation elements. These colors would then be respected during rendering.
Notes
- We have a
public colors: Map<NoteElement, Color|null>;
on theNote
class wherenull
indicates a reset to the default color of therenderingResources
NoteElement
is an enumerations for the different elements where we want to support custom colors which are then respected by drawing.- We could start with rather not many enum values covering the main areas (standard notation note heads, accidentals, tab numbers, numbered notation numbers, slash notation note head, stem, bar, and maybe some effect groups).
- There is likely an overlap of one enumeration affecting multiple notation elements. A more coarse enum value might color multiple elements of a notation while a specific enum value addresses only one particular element of a note.
- some good initial defaults would be:
- standard notation note head
- standard notation accidentals
- guitar tablature fret numbers
- numbered notation numbers
- slash notation note head
- staff level note effects/annotations
Beats
On the beat we follow the same principles like on notes but the elements to color would be specific to anything on beat level:
- stems
- flags
- bars
Voice
Voices on colors would be rather simple and override the color defined on renderingResources
.
Bars
On the bar we follow the same principles like on notes but the elements to color would be specific to anything on bar level:
- key signature
- time signature
- clefs
- staff lines
Score
On the score we follow the same principles like on notes but the elements to color would be specific to anything on score level:
- Song info
- Tuning info
- Chord diagrams
Performance Consideration
Accessing and changing colors for individual elements can have a quite significant performance impact. We want to avoid that in every glyph we have intensive code for checking for color changes and applying them.
We need some sort of "color container" taking care of providing the colors during rendering. Typically the performance should be on-par with the current logic, only if there are overrides they will have an impact during rendering (e.g. DOM parsing or updates on the rendering context).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status