Skip to content
import Theme from "@arcgis/core/views/Theme.js";
Inheritance:
ThemeAccessor
Since
ArcGIS Maps SDK for JavaScript 4.28

This class is used by the View to define the base colors used by analyses and widgets to render temporary graphics and labels. It is important to note that the colors defined in this class are merely base colors. Analyses and widgets may create derived colors with varying opacity and contrast, and each widget and analysis will display the theme colors in different ways.

The theme can be defined to complement an application's design or to contrast a map's content. For example, defining a purple accentColor will allow the user to clearly see measurement graphics on a red-orange colored basemap. Or defining a light textColor would display best against a dark background. Typically, theme colors are reactive and can be updated on-the-fly.

Currently, the following analyses and widgets honor this property. Note that the analyses which are available depends on if you are working in a 2D MapView or 3D SceneView: AreaMeasurementAnalysis, dimensioning, DirectLineMeasurementAnalysis, DistanceMeasurementAnalysis, ElevationProfileAnalysis, LineOfSightAnalysis, SliceAnalysis, and draw tools, Editor, Sketch, snapping.

Known Limitations

Theme does not affect the following: The lines and labels of DimensionAnalysis and DimensionLayer. Please use style instead. Theme colors don't affect the the profile lines of ElevationProfileAnalysis. Please set colors on ElevationProfileAnalysis.profiles instead. Theme colors don't affect the sight lines of LineOfSightLayer and LineOfSightAnalysis. Theme colors don't affect the visualization of ViewshedAnalysis.

See also
Example
// Update the theme to use purple graphics
// and slightly transparent green text
view.theme = new Theme({
accentColor: "purple",
textColor: [125, 255, 13, 0.9]
});

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
declaredClass
readonly inherited

accentColor

autocast Property
Type
Color

The base color used to render temporary graphics in the View.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

textColor

autocast Property
Type
Color

The base color used to render temporary labels in the View.

Methods

MethodSignatureClass
clone
inherited
clone(): this

clone

inherited Method
Signature
clone (): this
Inherited from: ClonableMixin

Creates a deep clone of this object. Any properties that store values by reference will be assigned copies of the referenced values on the cloned instance.

Returns
this

A deep clone of the class instance that invoked this method.