color doesn't apply with \ angle and defined colors

0 votes
asked Oct 10, 2017 in Bug by Dresaan (400 points)
With the following code, the background color is not applied:

!define TestColor red
skinparam classBackgroundColor PaleGreen\TestColor

All other variants that I tested are working:

skinparam classBackgroundColor PaleGreen/TestColor
skinparam classBackgroundColor PaleGreen-TestColor
skinparam classBackgroundColor PaleGreen\red
skinparam classBackgroundColor PaleGreen-#F00

1 Answer

0 votes
answered Oct 10, 2017 by plantuml (294,960 points)
selected Oct 11, 2017 by Dresaan
 
Best answer

Forget to mention it, but this issue has been partially solved in version 1.2016.18
This should be working now:

http://www.plantuml.com/plantuml/uml/Kqn9JSlCIrK8IIqkSSxFoIzIA4fDuIhEpimhI2nAp5L8paaiBdPAJCvEByelpKk1A0b8p4brBqfDpOk1Q-FY0gjKIClFvm80


There is still an issue if your define name starts with a "n", because the \n is interpreted by the preprocessor as a "newline" character.
The only workaround right now is to avoid name starting with "n" :-)

Non-working example:

!define newTestColor red
skinparam classBackgroundColor PaleGreen\newTestColor


http://www.plantuml.com/plantuml/uml/Kqn9JSlCIrN8IoqFIIqkSSxFoIzIA4fDuIhEpimhI2nAp5L8paaiBdPAJCvEByelpKk1A0b8p4brBqfDpOj1ria5LgkGbf_F1G00?switch
 

commented Oct 11, 2017 by Dresaan (400 points)
Maybe you can escape the \ with an additional \.
Like:

skinparam classBackgroundColor PaleGreen\\newTestColor

That would be a possible workaround.
You could also escape it with a following space. That would propable more intuitive for non-developers which don't know the \n.

I don't know how you are parsing the values. I think there is a point where you have the complete color including the gradient. Like:

PaleGreen\newTestColor

On that string you can just replace \n with the previous mentioned escaped solution. :-)
...