com.aspose.words

Class ThemeColors

  • java.lang.Object
    • 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 colors and fonts for themes.
Document doc = new Document(getMyDir() + "Theme colors.docx");

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

// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

// Other languages may also have their custom fonts in this theme.
Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// The "Colors" property contains the color palette from Microsoft Word,
// which appears when changing shading or font color.
// Apply custom colors to the color palette so we have easy access to them in Microsoft Word
// when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
// or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
ThemeColors colors = theme.getColors();
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);

// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

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

Property Getters/Setters Summary
java.awt.ColorgetAccent1()
void
setAccent1(java.awt.Colorvalue)
           Specifies color Accent 1.
java.awt.ColorgetAccent2()
void
setAccent2(java.awt.Colorvalue)
           Specifies color Accent 2.
java.awt.ColorgetAccent3()
void
setAccent3(java.awt.Colorvalue)
           Specifies color Accent 3.
java.awt.ColorgetAccent4()
void
setAccent4(java.awt.Colorvalue)
           Specifies color Accent 4.
java.awt.ColorgetAccent5()
void
setAccent5(java.awt.Colorvalue)
           Specifies color Accent 5.
java.awt.ColorgetAccent6()
void
setAccent6(java.awt.Colorvalue)
           Specifies color Accent 6.
java.awt.ColorgetDark1()
void
setDark1(java.awt.Colorvalue)
           Specifies color Dark 1.
java.awt.ColorgetDark2()
void
setDark2(java.awt.Colorvalue)
           Specifies color Dark 2.
java.awt.ColorgetFollowedHyperlink()
void
setFollowedHyperlink(java.awt.Colorvalue)
           Specifies color for a clicked hyperlink.
java.awt.ColorgetHyperlink()
void
setHyperlink(java.awt.Colorvalue)
           Specifies color for a hyperlink.
java.awt.ColorgetLight1()
void
setLight1(java.awt.Colorvalue)
           Specifies color Light 1.
java.awt.ColorgetLight2()
void
setLight2(java.awt.Colorvalue)
           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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        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 colors and fonts for themes.
        Document doc = new Document(getMyDir() + "Theme colors.docx");
        
        // The "Theme" object gives us access to the document theme, a source of default fonts and colors.
        Theme theme = doc.getTheme();
        
        // Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
        theme.getMajorFonts().setLatin("Courier New");
        theme.getMinorFonts().setLatin("Agency FB");
        
        // Other languages may also have their custom fonts in this theme.
        Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
        Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
        Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");
        
        // The "Colors" property contains the color palette from Microsoft Word,
        // which appears when changing shading or font color.
        // Apply custom colors to the color palette so we have easy access to them in Microsoft Word
        // when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
        // or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
        ThemeColors colors = theme.getColors();
        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);
        
        // Apply custom colors to hyperlinks in their clicked and un-clicked states.
        colors.setHyperlink(Color.WHITE);
        colors.setFollowedHyperlink(Color.lightGray);
        
        doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");