This returns an Aspose.Slides.IFillFormat object with Aspose.Slides.IColorFormat SolidFillColor. This in turn lets us access Aspose.Slides.SchemeColor SchemeColor.
In some cases IFillFormat.FillType is NotDefined. From my understanding, this happens when the shape does not explicitly store the text color but it is derived from some standard settings.
I think for this scenario we have IFillFormat.GetEffective(). However, it returns an Aspose.Slides.IFillFormatEffectiveData object which does not expose Aspose.Slides.IColorFormat SolidFillColor but System.Drawing.Color SolidFillColor. System.Drawing.Color only gives us the RGB value of the color but won’t tell if it’s a PowerPoint scheme color or not.
Do you have some suggestion how I can determine the scheme color used for the text in this case?
You’re seeing IFillFormat.FillType = NotDefined because the portion inherits its color from the presentation’s theme rather than storing an explicit fill.
What you can do
Call GetEffective() on the FillFormat to obtain the resolved RGB color (as a System.Drawing.Color). This gives you the actual color that PowerPoint uses for the text.
To find out which theme (scheme) color that RGB value corresponds to, compare it with the colors defined in the presentation’s color scheme (e.g., the slide master’s ColorScheme). By matching the RGB values you can identify the SchemeColor (Accent1, Dark1, etc.) that the text is inheriting. If no match is found, the text uses a custom RGB color.
Note
The current API does not expose the scheme‑color identifier directly from GetEffective(). Using the RGB comparison with the theme’s color scheme is the practical way to determine the inherited scheme color. If you need a more direct property, let us know and we can forward the request.
Thanks. I can try RGB matching against the theme colors. But there are at least two issues that I’m aware of:
The user may have chosen a visual scheme color but as RGB value. This is a subtle difference since changing the theme will not change the color.
Users can choose lighter and darker variants of scheme colors. In this case the resulting RGB value will not match the scheme color leaving no way to determine the original scheme color.
One more thing, Aspose.Slides.SchemeColor has options Background1, Background2, Text1, Text2. From Shape.Presentation.MasterTheme.ColorScheme we get IColorScheme which has Dark1, Dark2, Light1, Light2 instead.
@co213,
Thank you for contacting free support. Could you please share sample files and describe the expected result for the case so we can understand the issue better and answer your questions?
@andrey.potapov - Please have a look at the attached slide. The text shape uses the Text1 scheme color for the font. But the following code prints NotDefined.
using (var presentation = new Presentation("TextColor.pptx"))
{
Console.Out.WriteLine(((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType);
}
@co213,
Thank you for the sample presentation file.
We have opened the following new ticket(s) in our internal issue tracking system and will consider your questions according to the terms mentioned in Free Support Policies.
I understand that the Aspose team may implement a proper way for accessing the effective scheme color but you are not able to tell if and when this might be ready.
In the meantime, could you please help designing the workaround that Professionalize.Discourse suggested? I could not find answers to the following questions.
How do I access the applicable slide master’s color scheme? I realized that each master may have its own color scheme. But I only found Presentation.MasterTheme.ColorScheme for accessing one color scheme at the presentation level.
When the RGB value matches ColorScheme.Dark1, how can I tell if this is SchemeColor.Text1 or SchemeColor.Background1?
There is no dynamic mapping between Text/Background and Dark/Light colors — they are the same theme color slots with different names.
In older versions of Office, they were called:
Dark 1 / Light 1
Dark 2 / Light 2
In newer versions, they appear as:
Text 1 / Background 1
Text 2 / Background 2
The mapping is fixed:
Text 1 = Dark 1
Background 1 = Light 1
Text 2 = Dark 2
Background 2 = Light 2
Please use the following code snippet:
using (var presentation = new Presentation("TextColor.pptx"))
{
var slide = presentation.Slides[0];
var colorScheme = slide.LayoutSlide.MasterSlide.ThemeManager.OverrideTheme.ColorScheme;
}
Also, in Aspose.Slides for .NET 26.3, we expect the new SolidFillSchemeColor property to be added to the IFillFormatEffectiveData interface. It will allow you to get the fill color defined by the color scheme.
Thanks for sharing the additional advice and the update @andrey.potapov!
I will use IFillFormatEffectiveData.SolidFillSchemeColor which will give me exactly what I need.
I’ll also keep Text 1 = Dark 1 etc. and slide.LayoutSlide.MasterSlide.ThemeManager.OverrideTheme.ColorScheme in mind for the next time accessing scheme color