Search code examples
plantuml

Change the background colour of a mindmap object by using labels


I want to do: change the background colour of all objects with the label <folder> to blue

enter image description here


@startmindmap

skinparam backgroundColor transparent

* layer 1
 * layer 2
  * obj
  * obj
  * <&folder> obj folder
 * layer 2
  * <&folder> obj folder
@endmindmap

If anyone has experience of this, I would gladly accept any 'pearls of wisdom' they are willing to impart.


Solution

  • @startmindmap
    skinparam backgroundColor #EEAADD
    
    *[#FF0000] Debian
    **[#Orange] Ubuntu
    ***[#LightGreen] Linux Mint
    **[#Green] Rasbian
    
    @endmindmap
    

    Using this syntax you can color your boxes.

    I found this method on this link.

    Demo

    <?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="130px" preserveAspectRatio="none" style="width:334px;height:130px;background:#EEAADD;" version="1.1" viewBox="0 0 334 130" width="334px" zoomAndPan="magnify"><defs><filter height="300%" id="f1n8snf7oca3o3" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#FF0000" filter="url(#f1n8snf7oca3o3)" height="39.9404" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="65" x="10" y="49.9702"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="45" x="20" y="76.8345">Debian</text><rect fill="#FFA500" filter="url(#f1n8snf7oca3o3)" height="39.9404" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="65" x="125" y="20"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="45" x="135" y="46.8643">Ubuntu</text><rect fill="#90EE90" filter="url(#f1n8snf7oca3o3)" height="39.9404" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="83" x="240" y="20"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="63" x="250" y="46.8643">Linux Mint</text><path d="M190,39.9702 L200,39.9702 C215,39.9702 215,39.9702 230,39.9702 L240,39.9702 " fill="none" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M75,69.9404 L85,69.9404 C100,69.9404 100,39.9702 115,39.9702 L125,39.9702 " fill="none" style="stroke: #A80036; stroke-width: 1.0;"/><rect fill="#008000" filter="url(#f1n8snf7oca3o3)" height="39.9404" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="72" x="125" y="79.9404"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="52" x="135" y="106.8047">Rasbian</text><path d="M75,69.9404 L85,69.9404 C100,69.9404 100,99.9106 115,99.9106 L125,99.9106 " fill="none" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[a83dff5f9fd7a46abce9d8ea448b7c30]
    @startmindmap
    skinparam backgroundColor #EEAADD
    
    *[#FF0000] Debian
    **[#Orange] Ubuntu
    ***[#LightGreen] Linux Mint
    **[#Green] Rasbian
    
    @endmindmap 
    --></g></svg>