com.aspose.words
Class ThemeColors

java.lang.Object
    extended by com.aspose.words.ThemeColors
All Implemented Interfaces:
java.lang.Cloneable

public class ThemeColors 
extends java.lang.Object

Represents the color scheme of the document theme which contains twelve colors.

ThemeColors object contains six accent colors, two dark colors, two light colors and a color for each of a hyperlink and followed hyperlink.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

Property Getters/Setters Summary
java.awt.ColorgetAccent1()
voidsetAccent1(java.awt.Color value)
           Specifies color Accent 1.
java.awt.ColorgetAccent2()
voidsetAccent2(java.awt.Color value)
           Specifies color Accent 2.
java.awt.ColorgetAccent3()
voidsetAccent3(java.awt.Color value)
           Specifies color Accent 3.
java.awt.ColorgetAccent4()
voidsetAccent4(java.awt.Color value)
           Specifies color Accent 4.
java.awt.ColorgetAccent5()
voidsetAccent5(java.awt.Color value)
           Specifies color Accent 5.
java.awt.ColorgetAccent6()
voidsetAccent6(java.awt.Color value)
           Specifies color Accent 6.
java.awt.ColorgetDark1()
voidsetDark1(java.awt.Color value)
           Specifies color Dark 1.
java.awt.ColorgetDark2()
voidsetDark2(java.awt.Color value)
           Specifies color Dark 2.
java.awt.ColorgetFollowedHyperlink()
voidsetFollowedHyperlink(java.awt.Color value)
           Specifies color for a clicked hyperlink.
java.awt.ColorgetHyperlink()
voidsetHyperlink(java.awt.Color value)
           Specifies color for a hyperlink.
java.awt.ColorgetLight1()
voidsetLight1(java.awt.Color value)
           Specifies color Light 1.
java.awt.ColorgetLight2()
voidsetLight2(java.awt.Color value)
           Specifies color Light 2.
 

Property Getters/Setters Detail

getAccent1/setAccent1

public java.awt.Color getAccent1() / public void setAccent1(java.awt.Color value)
Specifies color Accent 1.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getAccent2/setAccent2

public java.awt.Color getAccent2() / public void setAccent2(java.awt.Color value)
Specifies color Accent 2.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getAccent3/setAccent3

public java.awt.Color getAccent3() / public void setAccent3(java.awt.Color value)
Specifies color Accent 3.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getAccent4/setAccent4

public java.awt.Color getAccent4() / public void setAccent4(java.awt.Color value)
Specifies color Accent 4.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getAccent5/setAccent5

public java.awt.Color getAccent5() / public void setAccent5(java.awt.Color value)
Specifies color Accent 5.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getAccent6/setAccent6

public java.awt.Color getAccent6() / public void setAccent6(java.awt.Color value)
Specifies color Accent 6.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getDark1/setDark1

public java.awt.Color getDark1() / public void setDark1(java.awt.Color value)
Specifies color Dark 1.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getDark2/setDark2

public java.awt.Color getDark2() / public void setDark2(java.awt.Color value)
Specifies color Dark 2.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getFollowedHyperlink/setFollowedHyperlink

public java.awt.Color getFollowedHyperlink() / public void setFollowedHyperlink(java.awt.Color value)
Specifies color for a clicked hyperlink.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getHyperlink/setHyperlink

public java.awt.Color getHyperlink() / public void setHyperlink(java.awt.Color value)
Specifies color for a hyperlink.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getLight1/setLight1

public java.awt.Color getLight1() / public void setLight1(java.awt.Color value)
Specifies color Light 1.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getLight2/setLight2

public java.awt.Color getLight2() / public void setLight2(java.awt.Color value)
Specifies color Light 2.

Example:

Shows how to set custom theme colors and fonts.
Document doc = new Document(getMyDir() + "ThemeColors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.getTheme();

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.getColors();

// We will set the color of each color palette column going from left to right like this
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// We can also set colors for hyperlinks like this
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.