Represents an AutoCAD-like entity color object.

This class mimics ObjectARX AcCmEntityColor. It stores:

  • A color method (AcCmColorMethod)
  • A single numeric value that represents:
    • RGB (packed R/G/B)
    • ACI index
    • Layer index

It uses lazy decoding/encoding to expose convenient getters/setters.

Constructors

  • Constructs a new AcCmEntityColor.

    Parameters

    • Optionalmethod: AcCmColorMethod

      Initial color method (defaults to ByColor)

    • Optionalvalue: number

      Internal packed value (defaults to 0)

    Returns AcCmEntityColor

Properties

_colorMethod: AcCmColorMethod

The method used to determine the final color. Defaults to AcCmColorMethod.ByColor (RGB).

Accessors

  • get blue(): number
  • Gets the blue component (0–255). Only valid when colorMethod = ByColor.

    Returns number

  • set blue(v: number): void
  • Sets the blue component and updates the packed RGB value.

    Parameters

    • v: number

    Returns void

  • get colorIndex(): number
  • Gets the AutoCAD Color Index (ACI). Only valid when colorMethod = ByACI.

    Returns number

  • set colorIndex(index: number): void
  • Sets the AutoCAD Color Index (ACI).

    Parameters

    • index: number

    Returns void

  • get colorMethd(): AcCmColorMethod
  • Gets the method used to determine the final color.

    Returns AcCmColorMethod

  • get green(): number
  • Gets the green component (0–255). Only valid when colorMethod = ByColor.

    Returns number

  • set green(v: number): void
  • Sets the green component and updates the packed RGB value.

    Parameters

    • v: number

    Returns void

  • get layerIndex(): number
  • Gets the referenced layer index. Only valid when colorMethod = ByLayer.

    Returns number

  • set layerIndex(index: number): void
  • Sets the layer index for ByLayer color mode.

    Parameters

    • index: number

    Returns void

  • get rawValue(): number
  • Gets the packed internal value.

    • RGB → packed 24-bit integer
    • ACI → index
    • Layer → index

    Returns number

  • set rawValue(v: number): void
  • Sets a raw internal value. The meaning depends on colorMethod.

    Parameters

    • v: number

    Returns void

  • get red(): number
  • Gets the red component (0–255). Only valid when colorMethod = ByColor.

    Returns number

  • set red(v: number): void
  • Sets the red component and updates the packed RGB value.

    Parameters

    • v: number

    Returns void

Methods

  • Returns true if the color method is ByACI.

    Returns boolean

  • Returns true if the color method is ByBlock.

    Returns boolean

  • Returns true if the color method is ByColor (explicit RGB).

    Returns boolean

  • Returns true if the color method is ByLayer.

    Returns boolean

  • Returns true if color is uninitialized or invalid.

    Returns boolean

  • Sets all RGB components.

    Parameters

    • r: number

      Red (0–255)

    • g: number

      Green (0–255)

    • b: number

      Blue (0–255)

    Returns void