ericferon / glpi-archimap

GLPI plugin for drawing architecture maps (based on draw.io)
GNU General Public License v2.0
19 stars 10 forks source link

Change default styles (for new drawing, Import or Cut Paste) #49

Closed derry43 closed 2 years ago

derry43 commented 2 years ago

Version 3.1.2

When I create a new drawing, the default style for shapes is:

Shapes Fill colour: #E1D5E7 Line colour: #9673A6 Text Colour: #774400

and the default style for connectors is:

Connectors Line colour: #6482B9 Text colour: #446299

I expected the default styles to be black on white (as per draw.io and draw.io desktop).

There appears no way to change this. I looked at the file drawio/src/main/webapp/styles\default.xml and these are not the styles defined there:

    <add as="defaultVertex">
        <add as="shape" value="label"/>
        <add as="perimeter" value="rectanglePerimeter"/>
        <add as="fontSize" value="12"/>
        <add as="fontFamily" value="Helvetica"/>
        <add as="align" value="center"/>
        <add as="verticalAlign" value="middle"/>
        <add as="fillColor" value="#ffffff"/>
        <add as="strokeColor" value="#000000"/>
        <add as="fontColor" value="#000000"/>
    </add>
    <add as="defaultEdge">
        <add as="shape" value="connector"/>
        <add as="labelBackgroundColor" value="#ffffff"/>
        <add as="endArrow" value="classic"/>
        <add as="fontSize" value="11"/>
        <add as="fontFamily" value="Helvetica"/>
        <add as="align" value="center"/>
        <add as="verticalAlign" value="middle"/>
        <add as="rounded" value="1"/>
        <add as="strokeColor" value="#000000"/>
        <add as="fontColor" value="#000000"/>
    </add>

I can modify the default styles for these on a per diagram basis by editing a shape/line and clicking the Save as Default Style" button. A pain, but not too much of an issue.

However, when I import or cut/paste a diagram from the desktop version of draw.io or even another diagram in GLPI, any shapes or lines without a defined colour get the same unexpected default values. This happens even if I have first saved a new default style in the diagram:

Shapes Fill colour: #E1D5E7 Line colour: #9673A6 Text Colour: #774400

Connectors Line colour: #6482B9 Text colour: #446299

Any ideas? Is there a way to change this?

There also does not appear to be a way to change the theme back to the Default from the Minimal theme.

derry43 commented 2 years ago

Not fixed in the latest version 3.2.2, the default colours for shapes etc now seem to be:

Shapes Fill colour: #C3D9FF Line colour: #6482B9 Text Colour: #774400

Connectors Line colour: #6482B9 Text colour: #446299

And these appear to be hard coded in the .js and .min.js files.

So I ended up replacing C3D9FF with FFFFFF 64829B9 with 000000 774400 with 000000 446299 with 000000

in all of the min.js and js files in which they appeared. Please check and fix as the current code means that when you click on the shape style with white background and black edges, you end up with #C3D9FF background and #6482B9 edges etc.

ericferon commented 2 years ago

I didn't change the color codes from the mxgraph- or drawio projects, but this GLPI integration is using the embedded version of drawio which could be different. Anyway, I updated the color codes for the used version, in v3.2.4. K.r,