Skip to content

UIColor.systemGray2Color static property ​

The UIColor.systemGray2Color static property is the level-2 gray among the system colors. From systemGray2 to systemGray6 the grays get closer to the background: lighter and lighter in Light Mode, darker and darker in Dark Mode.

You don't need it in everyday code: write the string 'systemGray2' directly to a color property for the same effect.

Value ​

UIColor.

  • Read-only. Assigning to it throws TypeError.
  • Reading it always returns the same object: UIColor.systemGray2Color === UIColor.systemGray2Color is true.
  • Assigning it to a color property has the same effect as writing 'systemGray2'. It reads back as the string 'systemGray2', not a UIColor object (verified by testing).
  • The exact value has not been measured.

Examples ​

js
const box = new UIView();
box.backgroundColor = UIColor.systemGray2Color;
console.log(box.backgroundColor);

Result: The console prints systemGray2. The on-screen color is not verified in the simulator.

Corresponding iOS API ​

UIColor.systemGray2Color. In Swift the name is UIColor.systemGray2, which matches the color name string here.

See also ​