import Theme from "@arcgis/core/views/Theme.js";const Theme = await $arcgis.import("@arcgis/core/views/Theme.js");- Inheritance:
- Theme→
Accessor
- 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.
Example
// Update the theme to use purple graphics// and slightly transparent green textview.theme = new Theme({ accentColor: "purple", textColor: [125, 255, 13, 0.9]});Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
Methods
| Method | Signature | Class |
|---|---|---|
clone inherited | clone(): this |
clone
- Signature
-
clone (): this
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.