ThemeColors
Inheritance: java.lang.Object
All Implemented Interfaces: java.lang.Cloneable
public class ThemeColors implements Cloneable
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.
Examples:
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");
Methods
Method | Description |
---|---|
getAccent1() | Specifies color Accent 1. |
getAccent2() | Specifies color Accent 2. |
getAccent3() | Specifies color Accent 3. |
getAccent4() | Specifies color Accent 4. |
getAccent5() | Specifies color Accent 5. |
getAccent6() | Specifies color Accent 6. |
getDark1() | Specifies color Dark 1. |
getDark2() | Specifies color Dark 2. |
getFollowedHyperlink() | Specifies color for a clicked hyperlink. |
getHyperlink() | Specifies color for a hyperlink. |
getLight1() | Specifies color Light 1. |
getLight2() | Specifies color Light 2. |
setAccent1(Color value) | Specifies color Accent 1. |
setAccent2(Color value) | Specifies color Accent 2. |
setAccent3(Color value) | Specifies color Accent 3. |
setAccent4(Color value) | Specifies color Accent 4. |
setAccent5(Color value) | Specifies color Accent 5. |
setAccent6(Color value) | Specifies color Accent 6. |
setDark1(Color value) | Specifies color Dark 1. |
setDark2(Color value) | Specifies color Dark 2. |
setFollowedHyperlink(Color value) | Specifies color for a clicked hyperlink. |
setHyperlink(Color value) | Specifies color for a hyperlink. |
setLight1(Color value) | Specifies color Light 1. |
setLight2(Color value) | Specifies color Light 2. |
getAccent1()
public Color getAccent1()
Specifies color Accent 1.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getAccent2()
public Color getAccent2()
Specifies color Accent 2.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getAccent3()
public Color getAccent3()
Specifies color Accent 3.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getAccent4()
public Color getAccent4()
Specifies color Accent 4.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getAccent5()
public Color getAccent5()
Specifies color Accent 5.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getAccent6()
public Color getAccent6()
Specifies color Accent 6.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getDark1()
public Color getDark1()
Specifies color Dark 1.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getDark2()
public Color getDark2()
Specifies color Dark 2.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getFollowedHyperlink()
public Color getFollowedHyperlink()
Specifies color for a clicked hyperlink.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getHyperlink()
public Color getHyperlink()
Specifies color for a hyperlink.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getLight1()
public Color getLight1()
Specifies color Light 1.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
getLight2()
public Color getLight2()
Specifies color Light 2.
Examples:
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");
Returns: java.awt.Color - The corresponding java.awt.Color value.
setAccent1(Color value)
public void setAccent1(Color value)
Specifies color Accent 1.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setAccent2(Color value)
public void setAccent2(Color value)
Specifies color Accent 2.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setAccent3(Color value)
public void setAccent3(Color value)
Specifies color Accent 3.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setAccent4(Color value)
public void setAccent4(Color value)
Specifies color Accent 4.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setAccent5(Color value)
public void setAccent5(Color value)
Specifies color Accent 5.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setAccent6(Color value)
public void setAccent6(Color value)
Specifies color Accent 6.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setDark1(Color value)
public void setDark1(Color value)
Specifies color Dark 1.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setDark2(Color value)
public void setDark2(Color value)
Specifies color Dark 2.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setFollowedHyperlink(Color value)
public void setFollowedHyperlink(Color value)
Specifies color for a clicked hyperlink.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setHyperlink(Color value)
public void setHyperlink(Color value)
Specifies color for a hyperlink.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setLight1(Color value)
public void setLight1(Color value)
Specifies color Light 1.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |
setLight2(Color value)
public void setLight2(Color value)
Specifies color Light 2.
Examples:
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");
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The corresponding java.awt.Color value. |