add colors to pitches
This commit is contained in:
@ -774,6 +774,25 @@ MuseScore {
|
|||||||
// APPLY TEXT FORMATTING
|
// 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) {
|
function formatText(text) {
|
||||||
console.log("Formatting text - setting fontSize to:", userFontSize)
|
console.log("Formatting text - setting fontSize to:", userFontSize)
|
||||||
text.fontSize = userFontSize
|
text.fontSize = userFontSize
|
||||||
@ -943,6 +962,7 @@ MuseScore {
|
|||||||
|
|
||||||
cursor.add(text)
|
cursor.add(text)
|
||||||
formatText(text)
|
formatText(text)
|
||||||
|
text.color = getColor(noteName)
|
||||||
|
|
||||||
// Verify the text object has the properties set
|
// Verify the text object has the properties set
|
||||||
console.log("Text fontSize after format:", text.fontSize)
|
console.log("Text fontSize after format:", text.fontSize)
|
||||||
|
|||||||
Reference in New Issue
Block a user