forma-embedded-view-sdk
Version:
The Forma Embedded View SDK is a JavaScript library for creating custom extensions in Autodesk Forma Site Design (previously Spacemaker).
48 lines (47 loc) • 1.42 kB
TypeScript
import type { IframeMessenger } from "../iframe-messenger.js";
/**
* Set custom colors on elements in the scene.
*
* @remarks
* Available via {@link auto.Forma | Forma}.{@link index.EmbeddedViewSdk.render | render}.{@link render.RenderApi.elementColors | elementColors}.
*/
export declare class ElementColorApi {
#private;
/** @hidden */
constructor(iframeMessenger: IframeMessenger);
/**
* Set color override on the speficied elements.
* The color is set as a hex string, e.g. `#ff0000` in the sRGB color space.
*
* @example
* void Forma.selection.subscribe(({ paths }) => {
* Forma.render.elementColors.clearAll()
* const pathsToColor = new Map<string, string>()
* for (const path of paths) {
* pathsToColor.set(path, "#00ff00")
* }
* Forma.render.elementColors.set({ pathsToColor })
* })
*/
set(request: {
/** The internal paths of elements and their colors. */
pathsToColor: Map<string, string>;
}): Promise<{
id: string;
}>;
/**
* Clear color override on the speficied elements.
*/
clear(request: {
/** The internal paths of elements and their colors. */
paths: string[];
}): Promise<{
id: string;
}>;
/**
* Clear color override on the speficied elements.
*/
clearAll(): Promise<{
id: string;
}>;
}