When attaching multiple notes to different attributes of the same class, all notes on the same side of the class (for example, left) are rendered using the style/stereotype of the last note defined on that side.
using below plantuml:
@startuml
<style>
.yellow {
BackgroundColor #FFF3CD
BorderColor #FFEEBA
FontColor #664D03
LineColor #FFEEBA
LineThickness 1
RoundCorner 3
}
.red {
BackgroundColor #fd0000
BorderColor #ff0000
FontColor #ffffff
LineColor #fc6060
LineThickness 1
}
</style>
class "Test 1" as test {
Field1
Field2
method1()
method2()
}
note left of test::Field1 <<yellow>>
yellow note left
end note
note left of test::Field2 <<red>>
red note left
end note
class "Test 2" as test2 {
Field1
Field2
method1()
method2()
}
note right of test2::Field1 <<yellow>>
yellow note right
end note
note left of test2::Field2 <<red>>
red note left
end note
class "Test 3" as test3 {
Field1
Field2
method1()
method2()
}
note right of test3::Field1 <<yellow>>
yellow note right
end note
note left of test3::Field2 <<yellow>>
yellow note left
end note
note left of test3::method1 <<red>>
red note left
end note
@enduml
I would expect the "Test 1" notes to be red and yellow, but they are both red (they take the color/stereotype of the last defined note). I would also expect the two notes to the left of "Test 3" to be yellow and red respectively. Tested on online server.
Observations:
- If the notes are attached to different sides of the class (e.g. one left, one right), the colors are rendered correctly.
- If two or more notes exist on the same side, they all inherit the stereotype/style of the last note defined on that side.
- Reversing the order of the notes causes all notes to adopt the new last stereotype, suggesting the renderer applies a shared style to a group of notes on the same side.
- The issue occurs both with custom stereotypes (<<yellow>>, <<red>>) and appears related to note placement rather than stereotype definition.