ESM: import Theme from "@arcgis/core/views/Theme.js";
CDN: const Theme = await $arcgis.import("@arcgis/core/views/Theme.js");
Class: @arcgis/core/views/Theme
Since: ArcGIS Maps SDK for JavaScript 4.28
This class is used by the View to define the base colors used by widgets and components to render temporary graphics and labels. It is important to note that the colors defined in this class are merely base colors. Widgets and components may create derived colors with varying opacity and contrast, and each widget and tool 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 widgets and components honor this property. Note that the widgets available depends on if you are working in a 2D MapView or 3D SceneView: AreaMeasurement2D, dimensioning, AreaMeasurement3D, DirectLineMeasurement3D, DistanceMeasurement2D, draw tools, Editor, ElevationProfile, LineOfSight, Sketch, Slice, and snapping.
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
new Theme(properties)
Parameter
optionalSee the properties for a list of all the properties that may be passed into the constructor.
Show inherited properties Hide inherited properties
Property DetailsThe base color used to render temporary graphics in the View.
Inherited
Property declaredClass Stringreadonly
The name of the class. The declared class name is formatted as esri.folder.className
.
The base color used to render temporary labels in the View.
Show inherited methods Hide inherited methods
Method DetailsInherited
Method addHandles(handleOrHandles, groupKey)
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles
const handle = reactiveUtils.when(
() => !view.updating,
() => {
wkidSelect.disabled = false;
},
{ once: true }
);
this.addHandles(handle);
// Destroy the object
this.destroy();
Parameters
Handles marked for removal once the object is destroyed.
groupKey *
optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
Inherited
Method hasHandles(groupKey){Boolean}
Returns true if a named group of handles exist.
Parameter
groupKey *
optionalA group key.
Returns
Type Description Boolean Returnstrue
if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
obj.removeHandles("watch-view-updates");
}
Inherited
Method removeHandles(groupKey)
Removes a group of handles owned by the object.
Parameter
groupKey *
optionalA group key or an array or collection of group keys to remove.
Example
obj.removeHandles(); // removes handles from default group
obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4