ArcGIS Online

Pop-ups: use color in text elements

This blog article was originally published on September 25, 2012, and has been updated. The last previous update was May 23, 2022.

Crafting a great pop-up is essential for making great web maps. Use color in your pop-up text elements to apply more meaning or emphasis on attributes, or clarity to what your map is showing.

 

Examples

The example shown below uses color to emphasize specific bits of information, in this case the travel time shown in the analysis, the number of residents served, and the percentage of the total population.

Pop-up text color

Color can also be used in a pop-up to echo the legend and clarify the map style. The use of color and text helps the viewer understand the what they are seeing.

Pop-up text color

Below, the color in the pop-up emphasizes the unique value of the feature. Color matching was accomplished using ArcGIS Arcade. See the example at the end of this blog article.

Pop-up text color

Using Arcade, text in pop-ups can be displayed with colors based on the evaluation of expressions. In this example, if there was a loss of forest area red text is used. If an increase in forest area, green text is used.

Pop-up text color

 

Add color to text elements

Adding color to text in pop-ups can be accomplished by applying a color to the selected text, field, or Arcade expression. See Pop-ups: text element essentials to learn the basics of working with text content in pop-ups.

In the text editor, select the text, field, or expression and click the Font Color button, then choose any color. To apply a specific color, enter the hexadecimal value of the color you want. Colors used previously are saved and can be chosen again.

Choose color

Colors can be static (chosen in the color picker) or can be data-driven using an attribute or an expression that returns a hexadecimal color value. See the example in the next section.

The example shown below uses Static color. The peak name, elevation, prominence, and isolation are blue. The peak rank is red. The Arcade expression, which returns a ranking of prominence (Low, Moderate, High), is brown.

Pop-up text color
View larger image

 

Use Arcade expressions to add color

Arcade is an expression language that is supported across ArcGIS. It can be used to perform calculations, manipulate text, and evaluate logical statements.

In pop-ups, Arcade can be used in two ways; to create expressions in text elements that can be evaluated like fields, or as separate elements that return a complete block of content.

The example map includes two layers presenting the the techniques discussed below. The attribute expressions can be found by opening the Layers pane in the Contents (dark) toolbar, selecting a layer, then clicking Pop-ups in the Settings (light) toolbar. Click Attribute expressions in the Options pane to view then click an expression to view it in the Arcade editor.

Attribute expressions
View larger image

Use expressions and static color

Follow along by viewing and selecting the Observation Wells (static expression color) layer in the example map.

To accomplish the goal of coloring the text to show the well status, two expressions were constructed to evaluate the {STATUS} field which contains one of two attribute values; Active or Inactive.

The first expression, titled IsActive, evaluates whether the field for the feature contains the word Active.

IsActive Arcade expression

The second expression, titled IsInactive, evaluates whether the field for the feature contains the word Inactive.

IsInactive Arcade expression

In the Text element editor, a static color (chosen from the color picker) is applied to the expression, which is treated like a field. While the logic here may initially seem confusing, we are creating two expressions which return the string value Active or Inactive. If the expression does not evaluate to True, Null is returned. The results are shown below.

Static defined expression color
View larger image

Use expressions for data-driven hexadecimal color

Follow along by viewing and selecting the Observation Wells (data-driven hexadecimal color value from expression) layer in the example map.

You can also use expressions to return the hexadecimal color value to change pop-up text to match unique symbol colors. The Arcade expression shown below checks the STATUS field and returns the hex color value; green when active, red when inactive. If you have more unique values, just extend the expression for all possible values.

ReturnHexColor Arcade expression

Tip: Make sure to include the hash symbol (#) in the hexadecimal number.

Select the text in the Text element editor, then click the Font Color tool. Click Data-driven (the default is Static), then select the Arcade expression to return the hexadecimal color.

Curly braces { } will appear around the Font color tool and the selected text will be outlined. Using hex values you can set the color for the entire text block (as is done in this example), or individual words, fields, or expressions.

Data-driven font color from Arcade expression

The text color in the pop-up is now set by the expression and matches the feature color.

Data-driven color from Arcade expression

 

Color tips

As with many visual techniques, use pop-up color sparingly. Too much color can be distracting and detract from the overall map aesthetics.

Avoid light or pale colors, they are difficult to see on the white pop-up background. Bold text can help to highlight the color differences.

 

More information

For more information, see the following:

About the author

Corporate technology evangelist and advocate at Esri, focusing on ways to broaden access to geographic information and helping customers succeed with the ArcGIS system. On a good day I'm making a map, on a great day I'm on one. Email bszukalski@esri.com or connect on LinkedIn (https://www.linkedin.com/in/bernszukalski/).

Connect:

Next Article

Multi-Scale Contour Styling in ArcGIS Pro

Read this article