OpenXML SDK PowerPoint set chart color - charts

I am writing a module for a VB.NET web page, which takes values from a database and inserts them into Office documents. Using the Open XML SDK in Visual Studio, I have managed to modify both Excel and PowerPoint files, but I have an issue with the color in PowerPoint's charts:
How can I change the color of a PowerPoint chart using the Open XML SDK, without also making the color separate itself from the theme?
Details below.
After adding my values to the worksheet behind the chart, and updating the visual lines/bars, all of the series appear to be using the same color. Therefore I also need to set the color of the series in the chart. I currently do this with the following code:
Dim barChart1 As DocumentFormat.OpenXml.Drawing.Charts.BarChart = chartPart.ChartSpace.Descendants(Of BarChart).First
Dim barChartSeries = barChart1.Descendants(Of BarChartSeries).ToList
barChartSeries(0).ChartShapeProperties.Descendants(Of SolidFill).First.SchemeColor = New SchemeColor() With
{ .Val = DocumentFormat.OpenXml.Drawing.SchemeColorValues.Accent4}
Basically, I set the first bar in the chart to use Accent4 as its color. Accent1, 2, 3 and so on correspond to the colors in the color palette of the PowerPoint presentation's theme. After this code runs, the first bar of the chart will be using the fourth color of the current palette.
The problem I'm facing is that after the color is set with code, the color value appears to be saved separately from the actual theme colors.
If I open the PowerPoint file and change the theme, all colors change except the ones I modified. In this example, the first bar of the chart would keep the fourth color for the previous theme, instead of using the fourth color of the new theme as it's supposed to.
This becomes a problem because my company's clients are supposed to be able to change the theme to one that suits them better, but they can't do that easily if some of the colors stick.
I'm using the Accent colors because the alternative seems to be setting an actual RGB color value, which leads to the same problem. I have tried the PowerTools plugin by Eric White, which simplifies the process of updating the charts, but it does not appear to solve the color problem. I may be using it wrong, but I've been unable to find specific info on how to debug color issues.
Thank you in advance for any help.

I'm not sure if this is true for VB.NET and OpenXML, but in the PPT object model, Scheme colors are still supported to maintain compatibility with pre-2007 versions of PowerPoint. New versions use color themes, not schemes. (yeah, I know. Welcome to the BizarroWorld that is PowerPoint).
In VBA, you'd use something like this to set the fill color of the shape referred to by oSh to Accent Color 2 in the current color THEME.
oSh.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent2

Related

How can I customise colors in the highlight section that is different from the text colors?

Image to the issue
How to give custom colors for highlights different from text colors.
The documentation states that the color_map setting sets both of them.
Additionally looking at the source code you can confirm that this is not currently possible as both swatches get the colors from the same function.
See
https://github.com/tinymce/tinymce/blob/develop/modules/tinymce/src/themes/silver/main/ts/ui/core/color/ColorSwatch.ts#L135

How do I apply colors to a multi color svg in flutter?

I am looking for changing colors of an illustration svg in flutter. I tried flutter_svg package but it support applying only one color to the svg and if I do that svg will be displayed as a single color svg, individual colors are lost. Is there any way to change colors at runtime in flutter for a multi color svg?
Do you mean something like this? I call it SVG colorization.
I'll try to squeeze the concept into a short summary. In an SVG file, you need to play around with the fill property as it defines the hex color code.
In terms of programming, you would:
Extract the SVG file data as a String variable svgCode.
Assign the previous hex color code in previousColor & the currently selected hex color code in newColor.
Apply the String.replaceAll method on svgCode to replace the colors.
Update the value of the previousColor.
A more brief elaboration would be
/// Initially without any color selection.
SVGPicture.string('''<svg code with fill #f7ebcb>''');
/// After the user selects the red color.
SVGPicture.string('''<svg code with fill #FF0000>''');
This tutorial can help to solve your issue. Not only does this app changes the color on runtime, but it also allows the user to download the manipulated SVG code.

Change colour names in custom word theme

Im looking for a solution that may not exist but worth a try. I am currently making custom modifications to normal.docm to incorporate our corporate branding. We have successfully created a new colour theme with our corporate colours but would like to know if we can change the names of these colours in the tool tip when you hover over in the colour picker.
Word colour picker
We have specific names for each of the colours which are know throughout are brand guidlines.
Any help on this would be greatly appreciated.
Changing the name of theme colours from Accent 1, Accent 2 etc. simply isn't possible.

Dynamic background in nattable

I am reading some data from a javascript file and obtain the background color from it, it seems very simple but I cant find the proper function to dynamicly changed the background color base on these values. I have already tried changing configurations but it doesnot work, beacause the group of configlabels is not available for this colors.
BR,

Selected text color in the JFace tree

I'm preparing Eclipse editor where one of the tabs is a tree with some values. I'm using colors and font style to give more information for the user. E.g. when the user puts a value which is out of range then the font color is red, or when a value is non-default then the font has a bold style.
But the user has to move the selection to another cell to see if the color/style has changed or not. Is it possible to change the color/style of the selected cell in the JFace tree?
There are several ways to do this. The two most obvious are:
Add your own custom label provider. Example here.
Add a label decorator. Here is a older somewhat dated article.
It is not possible to change the colors via theming.