add colors to pitches

This commit is contained in:
2026-05-11 17:35:10 +02:00
parent fc8ba35542
commit d1bc05c208

View File

@ -774,6 +774,25 @@ MuseScore {
// APPLY TEXT FORMATTING
//---------------------------------------------------------
function getColor(noteName) {
const note = noteName.slice(0, -1)
const colorMap = {
C: "red",
"C#": "crimson",
D: "orange",
"D#": "gold",
E: "yellow",
F: "green",
"F#": "lime",
G: "blue",
"G#": "indigo",
A: "purple",
"A#": "violet",
B: "pink",
}
return colorMap[note] || "gray"
}
function formatText(text) {
console.log("Formatting text - setting fontSize to:", userFontSize)
text.fontSize = userFontSize
@ -943,6 +962,7 @@ MuseScore {
cursor.add(text)
formatText(text)
text.color = getColor(noteName)
// Verify the text object has the properties set
console.log("Text fontSize after format:", text.fontSize)