The Background Color macro allows you to change the background color of content, for example, to highlight a block of content to make it stand out on a page. Any background color can be specified using either color names or hexadecimal color codes.

Instructions

  1. Navigate to the page you want to edit.

  2. Click Edit.

  3. Click the position on the page where you want to insert the macro. The macro placeholder can be repositioned later if required.
  4. Click Insert More Content Other Macros.

  5. Select the Background Color macro from the Macro Browser.

    Macro Browser with Background Color macro highlighted.
  6. Define the color using the color parameter and optional CSS.

    ParameterDescriptionTypeDefaultRequired

    Color

    The background color for the content contained within the macro. This can be either a common color name (supported by most browsers) or a hexadecimal color code (supported by all browsers).

    string

    green

     (tick)

    CSS Class

    Option to apply a custom CSS class to the element. Enter the CSS class name(s) to apply to the macro (case sensitive); multiple classes can be separated by a space or comma. Do not include the . selector in the class name. Classes must be part of your Global Confluence CSS or defined in a CSS Stylesheet macro that you have added to your page.

    string

    none

     (error)

  7. Click Insert. The macro placeholder displays with space to add your content to the body of the macro.

    The placeholder for the Background Color macro.

Examples

Standard use

There are several built-in pastel colors ideal for use as backgrounds. Type the desired color to display one of the following:

Use standard browser color names to define additional colors, for example: 

Hexadecimal color code

To define a specific color, for example to match a theme, use a hexadecimal color code, e.g. #003366:

When changing background color, try to keep a contrast between the text and the background so that it is still clearly readable. If there is not enough contrast, you can use Confluence's text editor to change the font color as illustrated below.


The color options available for text in the Confluence text toolbar menu.

A Slate blue background with white example text.


Frequently Asked Questions

Q: Can I highlight just a few words within my text, rather than a whole block of content?

A: Yes. Use the Highlight macro.


Q: I’m using hexadecimal codes, but they are not working - why?

A: Unlike the Color macro, this macro requires the "#" at the start of the number.


Q: Where can I find HTML text color codes?

A: HTML Color Codes has a good color code reference page that shows each of the standard colors with the corresponding color code. If you want a groovy wall chart with color codes, try http://html-color-codes.com/.


Q: Some color names, such as "grey", don’t seem to work in all browsers - why?

A: Color names are supported differently by different browsers. To be 100% sure of getting the right color, use the hexadecimal color code instead.


Q: How do I change the color of text?

A: Use the Confluence text editor toolbar.


Q: How do I change the default background color of my page?

A: If you are using a standard theme, there are some limited options to change colors. If you are using the Builder Documentation theme, you have complete control over all colors using Builder CSS Custom Styles.


Q: Can I put a graphic in the background?

A: Yes. The Div and CSS Style Sheet macros allow you to apply far more customized styling to content.