Getting theme color for BPMN Events

Hi,
Is there a way to know if a shape has the theme applied to it and what color fill / line color it should have based on that theme?

File file = new File(PATH_TO_VSDX_FILE);
Diagram d = new Diagram(file.getAbsolutePath());
Page page = d.getPages().get(0);
ShapeCollection pageShapes = page.getShapes();
for(Shape shape : (Iterable<Shape>) pageShapes)
{
    shape.getInheritFill().getFillForegnd().getValue();
    shape.getShapes().get(1).getInheritFill().getFillForegnd().getValue();
}
// shape 1
// returns #FFFFFF <-- this is the white we expect for the theme
// returns #FFFF00

// shape 2
// returns #FFFFFF
// returns #EA700D <-- this is the orange we expect for the second shape

Ideally shape.getInheritFill().getFillForegnd().getValue(); would give you the color of the shape if set with Fill or by Theme.

event theme color.zip (30.5 KB)

@mcintken
Thanks for the template file and screenshots.
Our current returned values are correct. Please use the latest version 24.5, but it does not support determining if a theme is applied to a shape.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMJAVA-51206

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as DIAGRAMJAVA-51206) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou

Hi,

I saw that there is now a way to know if there is a themecolor, but there doesn’t seem to be any way that I know of on how to get what that color is?

@mcintken
I have tested your scenario/case using our latest version : Aspose.Diagram for Java v24.6 . It works fine and as expected.

       for(Shape shape : (Iterable<Shape>) pageShapes)
       {
           shape.getInheritFill().getFillForegnd().getValue();
           shape.getShapes().get(1).getInheritFill().getFillForegnd().getValue();
           System.out.println("\nshape : "  +shape.getID() +shape.getInheritFill().getFillForegnd().getValue()); 
           System.out.println("\nshapechild : "  +shape.getShapes().get(1).getID() +shape.getShapes().get(1).getInheritFill().getFillForegnd().getValue());
           
       }

It will give the output:
shape : 1#FFFFFF

shapechild : 3#FFFF00

shape : 1000#FFFFFF

shapechild : 1002#EA700D

Please find the shape “sheet.3” in the Visio interface. In the ShapeSheet view of Visio, we can clearly see that the FillForegnd of the child shape with shape ID 3 is “#FFFF00”. Similarly, this is correct for shape ID 1000.

If there are any inaccuracies in my description, please help point them out.
Thanks.

Hi,

Maybe I am still missing something, but I am still using the same code as originally provided with Aspose.Diagram for Java v24.6 and not getting the expected result.

I attached an updated diagram to show off the issue. The diagram is made using Microsoft® Visio® 2021 MSO (Version 2405 Build 16.0.17628.20006) 64-bit , if that has any impact on the results. The white seems to have just been lucky while changing it to another theme (gemstone) in this case, it seems to result in the wrong color still.

The first shape (themed shape) is given the wrong color. it should be #9F2936 but instead I get
shape.getShapes().get(1).getInheritFill().getFillForegnd().getValue() //#664D26
shape.getInheritFill().getFillForegnd().getValue() // #FFFFFF

The second shape returns the expected color (using fill instead of theme)
shape.getShapes().get(1).getInheritFill().getFillForegnd().getValue() #30243C

Screenshot_2.png (40.5 KB)
events.zip (27.1 KB)

@mcintken
Thank you for additional information.
We have located the shape with ChildShape ID 3. From the Shapesheet page in Visio, we can see that its FillColor is #664d26. This can also be observed from the XML extracted from the original file. Please refer to the xml and attached image.

              	<Shape ID='3' Type='Shape' MasterShape='7'>
				<Cell N='LayerMember' V='0'/>
				<Cell N='FillForegnd' V='#664d26' F='THEMEGUARD(MSOTINT(THEMEVAL("AccentColor6"),-50))'/>
				<Cell N='FillBkgnd' V='#664d26' F='Inh'/>
				<Cell N='FillPattern' V='1'/>
				<Cell N='RotateGradientWithShape' V='0'/>
			   </Shape>

shape3fill.PNG (4.7 KB)

Hi,

You are correct, and perhaps it has been poor communication on my part regarding what I am asking for help with. I want to ultimately know if the shape is using the theme color or not. That way we can figure out what fill color it needs to be using should be.

  1. Is the current shape using the theme color?
  2. How to get the theme color information?

Currently, I am not finding a way to get either of these. Shape | Aspose.Diagram for Java API Reference returns true for both of the shapes which doesn’t help to know that the first shape should be using theme information while the second is overriding the theme color with the purple fill (#30243C).

I see that there is PresetThemeValue | Aspose.Diagram for Java API Reference but this doesn’t provide the actual styles/fills for the color just a mapping which seems to only be usable by the setPresetTheme. There doesn’t appear to be an alternate like getThePresetTheme which could be used to get that information (what the styles/fills are or just a mapping to be used to get that information).

I do not see any way to get the information in the theme1.xml (under the theme directory if you unzip the Visio file). Tried using the diagram shape.getDiagram().getStyleSheets() and looking through those and found one called theme but all the values in there seem to be just theme which isn’t helpful.

@mcintken
Thank you for the additional informations.

A preliminary idea is provide an API similar to ‘getThemeColor’ in the ‘fill’ property of ‘shape’. If a theme is set in the fill of shape, it will return ‘the themeColor’; otherwise, it will return ‘null’ or an empty value.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMJAVA-51212

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as DIAGRAMJAVA-51212) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou