Reputation: 857
I'm currently using PlantUML to design my database's ERD. All's well, the diagram is complete, but I'm trying to add a background color to my entities, to dintinguish them in their respective schemas.
I'm thinking of a backgroung color for the entities, or maybe a colored rectangle that holds the entities within it.
I tried using skinparam
with the name of the entity, with its alias...
skinparam entity {
backgroundColor<<usr>> DarkOrchid
}
skinparam entity {
backgroundColor<<User>> DarkOrchid
}
None of these work... Can anybody help?
Thanks
========= EDIT
As requested, a small example:
'==========='
'auth schema'
entity "User" as usr {
*id : number <<PK>>
--
password: varchar
salt: varchar
role: number <<FK>>
last_login_at : datetime
is_active : boolean
}
entity "User Role" as url {
*id : number <<PK>>
--
name: varchar
clearance_lvl: text
is_active : boolean
}
'====================='
'personnel data schema'
entity "Professor" as prof {
*id : number <<PK>>
--
name: varchar
office: integer
user_id: number <<FK>>
wage: number
last_login_at : datetime
is_active : boolean
}
entity "Student" as stu {
*id : number <<PK>>
--
name: varchar
semester: text
user_id: number <<FK>>
specialization: text
is_active : boolean
}
usr ||--o{ url
prof ||--|| usr
stu ||--|| usr
Upvotes: 3
Views: 5967
Reputation: 1149
The entity
object uses the skinparams of class
! So, you would have to say skinparam class
instead of skinparam entity
to change the background color of your entities.
To apply a certain background color to a selection of entities, you would have to add a stereotype to them so that they can be identified by the skinparam class
command. For example, you could add <<personnel>>
to the Professor
and Student
entities and BackgroundColor<<personnel>>
to skinparam class
.
This should fulfill the requirements of your first example:
skinparam class {
BackgroundColor<<personnel>> #A9DCDF
}
'==========='
'auth schema'
entity "User" as usr {
*id : number <<PK>>
--
password: varchar
salt: varchar
role: number <<FK>>
last_login_at : datetime
is_active : boolean
}
entity "User Role" as url {
*id : number <<PK>>
--
name: varchar
clearance_lvl: text
is_active : boolean
}
'====================='
'personnel data schema'
entity "Professor" as prof <<personnel>> {
*id : number <<PK>>
--
name: varchar
office: integer
user_id: number <<FK>>
wage: number
last_login_at : datetime
is_active : boolean
}
entity "Student" as stu <<personnel>> {
*id : number <<PK>>
--
name: varchar
semester: text
user_id: number <<FK>>
specialization: text
is_active : boolean
}
usr ||--o{ url
prof ||--|| usr
stu ||--|| usr
To implement your second example, you could wrap your entities into packages and apply a different background directly as part of the package
statement.
'==========='
'auth schema'
package "auth schema" #B4A7E5 {
entity "User" as usr {
}
entity "User Role" as url {
}
}
'====================='
'personnel data schema'
package "personnel data schema" #A9DCDF {
entity "Professor" as prof <<person>> {
}
entity "Student" as stu <<person>> {
}
usr ||--o{ url
prof ||--|| usr
stu ||--|| usr
Upvotes: 5