---
title: getObjectColors
slug: viewer-3d/methods/getObjectColors
docTags: 
createdAt: 2024-03-01T14:17:48.683Z
---

Returns a map of the specified objects and their colors.

:::hint{type="info"}
The map only contains objects assigned a custom color using [setObjectColors](docId\:o_aj55eSoIm34JZa6Mkpf).
:::

## Example

::codepen{url="https://codepen.io/Catenda/embed/XWLyJZQ"}

## Usage

```javascript
const objectIds = ["object-1", "object-2"];

const objectColorMap = viewer3d.getObjectColors(objectIds);
```

## Parameters

### objectIds

List of object ids.

| **Type**       | **Required** |
| -------------- | ------------ |
| Array\[String] | Yes          |

## Return Value

Map of object ids and their colors.

| **Type**     |
| ------------ |
| Map\[Object] |

**Properties**

| **Name**  | **Type** | **Description**                               |
| --------- | -------- | --------------------------------------------- |
| `color`   | Object   | RGB color components of the object            |
| `opacity` | Number   | Opacity of the object                         |
| `style`   | String   | RGBA Hex value of the color, i.e. `#ff0000ff` |

**Color**

| **Name** | **Type** | **Description** |
| -------- | -------- | --------------- |
| `r`      | Number   | Red component   |
| `g`      | Number   | Green component |
| `b`      | Number   | Blue component  |

### Example

```javascript
{
  objectId: {
    color: {
      r: 1,
      g: 0,
      b: 0,
    },
    opacity: 1,
    style: "#ff0000ff",
  },
};
```

