How can I apply a style or background color to a note on a class method?

0 votes
asked Nov 9, 2022 in Question / help by cwm9
@startuml

<style>
    note {
        .faint {
            BackgroundColor red
        }
    }
</style>

class A
{
   B()
}

note<<faint>> left of A::"B()"
 test red
end note

@enduml

2 Answers

0 votes
answered Nov 11, 2022 by poi (1,200 points)
The documentation doesn't say that it should work. Notice: "The style feature is still in testing stage."

However, I think the correct syntax should be

note left of A::B <<faint>>

but that throws an error with PlantUML version 1.2022.13beta7

"note left of A <<faint>>" produces a diagram, but the note background isn't red.

/poi
+1 vote
answered Dec 6, 2022 by The-Lu (74,900 points)

Hello C., P., and all,

FYI: this now works with the last version (V1.2022.13).

Here is an example:

@startuml
<style>
    note {
        .faint {
            BackgroundColor red
        }
    }
</style>

class A
{
   B()
}
note left of A::"B()" <<faint>>
 test red
end note
@enduml

Enjoy,
Thanks to PlantUML team. yes
Regards.

...