archimatetool / archi

Archi: ArchiMate Modelling Tool
https://www.archimatetool.com
MIT License
914 stars 267 forks source link

Support figure line thickness, derive line colour from fill colour and tweaking of figures #953

Closed Phillipus closed 8 months ago

Phillipus commented 10 months ago

This is an overall issue to track the following proposed changes:

  1. Allow to set the line thickness on all figures
  2. Change the "Derive element line colours from fill colours" setting so that it is set per figure, not at an application level
  3. Modify some of the element figures so they use either the fill colour or line colour, and also take into account the line thickness in (1) which may not be appropriate for some parts of the figure

The first part of (1) is committed in the dev branch. This allows setting line thickness of 1, 2, or 3 pixels named "Normal", "Medium" and "Heavy" to align with the names of the line thickness settings of a connection.

Phillipus commented 10 months ago

For (2) we propose to lose the user configurable "Contrast factor" setting and hard code it into the app.

And to convert the "Derive element line colours from fill colours" to a default setting. Then set it on or off for each figure.

The code for calculating the derived line colour should also be changed to account for dark fill colours.

Phillipus commented 10 months ago

For (3) we need to take an inventory of all element figures and summarise what fill colours, line colours, and line thicknesses are required for drawing the figure.

For example, the Plateau figure should use the fill colour instead of the line colour. Or the Goal figure should only use 1 pixel line thickness to draw the inner rings of the circle.

Phillipus commented 10 months ago

@jbsarrodie Regarding (2) the current default application setting for "Derive element line colours from fill colours" is true. Should the default also be true per figure?

We need two defaults:

  1. The overall application default for the setting of newly created objects
  2. The default for loading objects (if the feature is not set in the model file, should it default to true or false?)
Phillipus commented 10 months ago

derived

Phillipus commented 10 months ago

@jbsarrodie I created a new method to derive the line color:

public static Color getDerivedLineColor(Color color) {
    if(color == null) {
        return null;
    }

    float contrastFactor = 0.7f;

    RGB rgb = new RGB((int)(color.getRed() * contrastFactor), (int)(color.getGreen() * contrastFactor), (int)(color.getBlue() * contrastFactor));

    return get(convertRGBToString(rgb));
}

This is the same code as we used before (getDarkerColor) but, as you mentioned, this should now take into account darker colors and perhaps show a lighter color...can you suggest an algorithm?

jbsarrodie commented 10 months ago

This is the same code as we used before (getDarkerColor) but, as you mentioned, this should now take into account darker colors and perhaps show a lighter color...can you suggest an algorithm?

I have an implementation locally (which means I've successfully setup my eclipse and git environment), but I have an issue with pushing my work (most certainly due to corporate proxy). I can share the modified source code for ColorFactory in this issue if you want.

Phillipus commented 10 months ago

but I have an issue with pushing my work

Could it be because I have force pushed the dev branch and you need to pull it again?

I can share the modified source code for ColorFactory in this issue if you want.

OK

jbsarrodie commented 10 months ago

Could it be because I have force pushed the dev branch and you need to pull it again?

No, it doesn't even work on a brand new, empty, repository. It seems my corporate proxy (or other network security appliance) is rejecting POST request from git (but it does work from my browser).

Here is the proposed code (which does include a variant for getLighterColor()(current version clips some colors components, mine don't): ColorFactory.txt

jbsarrodie commented 10 months ago

Btw, after some experimentation, I finally think lightening the border color for dark fill color is not really a good option. Most of the time the figures are drawn on a white background and there is not enough contrast to see the border color anymore.

But drawing top right icon using a light (or white) color when fill color become too dark does improve things.

Phillipus commented 10 months ago

Here is the proposed code (which does include a variant for getLighterColor()(current version clips some colors components, mine don't): ColorFactory.txt

OK, that seems to work. Do you want to go with that? I can commit if required.

Phillipus commented 10 months ago

(dev branch rebased and force pushed)

Phillipus commented 10 months ago

@jbsarrodie Regarding (2) the current default application setting for "Derive element line colours from fill colours" is true. Should the default also be true per figure?

We need two defaults:

1. The overall application default for the setting of newly created objects

2. The default for loading objects (if the feature is not set in the model file, should it default to true or false?)

I'm thinking now that the defaults should be set to false

Phillipus commented 8 months ago

This is in Archi 5.2.