ThemeBase Class
The base class for presentation themes.
Declaration
public abstract class ThemeBase extends OfficeObject
Remarks
A theme consists of three main components:
- Color Scheme
- Defines theme colors.
- Font Scheme
- Defines fonts for titles and body text.
- Format Scheme
- Defines fills, line styles, and visual effects.
Refer to the following help topic for additional information: Presentation Themes.
Inherited Members
Inheritance
Methods
deepClone() Method
Clones the current ThemeBase instance.
Declaration
public ThemeBase deepClone()
Returns
| Type | Description |
|---|---|
ThemeBase |
The cloned |
getColorScheme() Method
Returns the theme’s color scheme.
Declaration
public ThemeColorScheme getColorScheme()
Returns
| Type | Description |
|---|---|
| ThemeColorScheme | The theme’s color scheme. |
getFontScheme() Method
Returns the theme’s font scheme.
Declaration
public ThemeFontScheme getFontScheme()
Returns
| Type | Description |
|---|---|
| ThemeFontScheme | The theme’s font scheme. |
getFormatScheme() Method
Returns the theme’s format scheme.
Declaration
public ThemeFormatScheme getFormatScheme()
Returns
| Type | Description |
|---|---|
| ThemeFormatScheme | The theme’s format scheme. |
setColorScheme(ThemeColorScheme value) Method
Updates the theme’s color scheme.
Declaration
public void setColorScheme(ThemeColorScheme value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | ThemeColorScheme | The theme’s color scheme. |
Remarks
The following code snippet modifies theme colors:
// Access the first slide master in the presentation.
SlideMaster slideMaster = presentation.getSlideMasters().get(0);
// Access the theme.
Theme theme = slideMaster.getTheme();
// Customize theme colors.
theme.getColorScheme().setAccent1(
new OfficeColor(Color.getOrange()));
theme.getColorScheme().setAccent2(
new OfficeColor(Color.getDarkOrange()));
theme.getColorScheme().setAccent3(
new OfficeColor(Color.getIndianRed()));
theme.getColorScheme().setDark2(
new OfficeColor(Color.getRed()));
Refer to the following help topic for additional information: Color Scheme.
setFontScheme(ThemeFontScheme value) Method
Sets the theme’s font scheme.
Declaration
public void setFontScheme(ThemeFontScheme value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | ThemeFontScheme | The theme’s font scheme. |
Remarks
The font scheme contains two font groups:
- Major font for titles and headings
- Use getMajorFont() and setMajorFont(ThemeFont value) methods to obtain and specify the major font.
- Minor font for body text
- Use getMinorFont() and setMinorFont(ThemeFont value) methods to obtain and specify the minor font.
The following code snippet customizes theme fonts:
// Access the theme.
Theme theme = slideMaster.getTheme();
// Customize major and minor fonts.
theme.getFontScheme().setMajorFont(new ThemeFont("Tahoma"));
theme.getFontScheme().setMinorFont(new ThemeFont("Calibri", "Calibri Light"));
Refer to the following help topic for additional information: Font Scheme.
setFormatScheme(ThemeFormatScheme value) Method
Sets the theme’s format scheme.
Declaration
public void setFormatScheme(ThemeFormatScheme value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | ThemeFormatScheme | The theme’s format scheme. |
Remarks
The format scheme contains the following collections:
- Fills
- getFills() — Fill styles for shapes and text boxes
- Background Fills
- getBackgroundFills() — Fill styles for slide backgrounds
- Line Styles
- getLineStyles() — Outline and connector styles