UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

69 lines (67 loc) 5.66 kB
import type Color from "../Color.js"; import type Accessor from "../core/Accessor.js"; import type { ClonableMixin } from "../core/Clonable.js"; import type { ColorLike } from "../Color.js"; export interface ThemeProperties { /** The base color used to render temporary graphics in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). */ accentColor?: ColorLike; /** The base color used to render temporary labels in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). */ textColor?: ColorLike; } /** * This class is used by the [View](https://developers.arcgis.com/javascript/latest/references/core/views/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](https://developers.arcgis.com/javascript/latest/references/core/views/Theme/#accentColor) will allow the user to clearly see measurement graphics on a red-orange colored * basemap. Or defining a light [textColor](https://developers.arcgis.com/javascript/latest/references/core/views/Theme/#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](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or [3D SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/): * [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/AreaMeasurementAnalysis/), * [dimensioning](https://developers.arcgis.com/javascript/latest/references/core/analysis/DimensionSimpleStyle/), * [DirectLineMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DirectLineMeasurementAnalysis/), * [DistanceMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DistanceMeasurementAnalysis/), * [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfileAnalysis/), * [LineOfSightAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysis/), * [SliceAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/SliceAnalysis/), and * [draw tools](https://developers.arcgis.com/javascript/latest/references/core/views/draw/Draw/), * [Editor](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/), * [Sketch](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/), * [snapping](https://developers.arcgis.com/javascript/latest/references/core/widgets/support/SnappingControls/). * * > [!WARNING] * > * > **Known Limitations** * > * > Theme does not affect the following: * > The lines and labels of [DimensionAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DimensionAnalysis/) and [DimensionLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionLayer/). Please use [style](https://developers.arcgis.com/javascript/latest/references/core/analysis/DimensionSimpleStyle/) instead. * > Theme colors don't affect the the profile lines of [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfileAnalysis/). Please set colors on [ElevationProfileAnalysis.profiles](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfileAnalysis/#profiles) instead. * > Theme colors don't affect the sight lines of [LineOfSightLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/LineOfSightLayer/) and [LineOfSightAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysis/). * > Theme colors don't affect the visualization of [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/). * * @since 4.28 * @see [View.theme](https://developers.arcgis.com/javascript/latest/references/core/views/View/#theme) * @see [Color](https://developers.arcgis.com/javascript/latest/references/core/Color/) * @see [Sample - Color theming for interactive tools](https://developers.arcgis.com/javascript/latest/sample-code/view-theme/) * @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] * }); */ export default class Theme extends ThemeSuperclass { constructor(properties?: ThemeProperties); /** The base color used to render temporary graphics in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). */ get accentColor(): Color; set accentColor(value: ColorLike); /** The base color used to render temporary labels in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). */ get textColor(): Color; set textColor(value: ColorLike); } declare const ThemeSuperclass: typeof Accessor & typeof ClonableMixin