java.lang.Objectcom.aspose.words.ThemeColors
public class ThemeColors
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:
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.Color | getAccent1() | |
void | setAccent1(java.awt.Color value) | |
Specifies color Accent 1. | ||
java.awt.Color | getAccent2() | |
void | setAccent2(java.awt.Color value) | |
Specifies color Accent 2. | ||
java.awt.Color | getAccent3() | |
void | setAccent3(java.awt.Color value) | |
Specifies color Accent 3. | ||
java.awt.Color | getAccent4() | |
void | setAccent4(java.awt.Color value) | |
Specifies color Accent 4. | ||
java.awt.Color | getAccent5() | |
void | setAccent5(java.awt.Color value) | |
Specifies color Accent 5. | ||
java.awt.Color | getAccent6() | |
void | setAccent6(java.awt.Color value) | |
Specifies color Accent 6. | ||
java.awt.Color | getDark1() | |
void | setDark1(java.awt.Color value) | |
Specifies color Dark 1. | ||
java.awt.Color | getDark2() | |
void | setDark2(java.awt.Color value) | |
Specifies color Dark 2. | ||
java.awt.Color | getFollowedHyperlink() | |
void | setFollowedHyperlink(java.awt.Color value) | |
Specifies color for a clicked hyperlink. | ||
java.awt.Color | getHyperlink() | |
void | setHyperlink(java.awt.Color value) | |
Specifies color for a hyperlink. | ||
java.awt.Color | getLight1() | |
void | setLight1(java.awt.Color value) | |
Specifies color Light 1. | ||
java.awt.Color | getLight2() | |
void | setLight2(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) |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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");