MLightCAD
    Preparing search index...

    Function toggleBlackWhiteBackgroundColor

    • Toggles a layout background colour between black and white.

      Inspects the current colour's perceived luminance via isLightBackground and returns a new AcCmColor set to pure black (RGB 0, 0, 0) when the input is light, or pure white (RGB 255, 255, 255) when the input is dark. If the source colour has no RGB component, MODEL_SPACE_BACKGROUND is used as the luminance reference.

      Used by AcApSwitchBgCmd to flip MODELBKCOLOR / PAPERBKCOLOR without disturbing other colour fields on the sysvar.

      Parameters

      • color: AcCmColor

        Current layout background colour from the database sysvar.

      Returns AcCmColor

      New AcCmColor with AcCmColorMethod.ByColor and inverted black/white RGB.

      const next = toggleBlackWhiteBackgroundColor(currentColor)
      sysVarManager.setVar(variableName, next, database)