Notes from building Lunille

macOS knows what colour your Magic Mouse is

I make a small Mac app called Lunille. It lives in the notch, and when you connect a Bluetooth accessory it shows a little 3D model of it with the battery level.

My Magic Mouse is black. For the app's first month on sale, it drew it white.

The fix seemed easy: ask macOS what colour the mouse is. macOS clearly knows, because its own "Connected" banner shows a black mouse. But nothing I'd normally reach for mentions colour. system_profiler SPBluetoothDataType gives the address, vendor ID, product ID (0x0269), firmware version and "Minor Type: Mouse". IOBluetooth has the name and the device class. No colour anywhere.

It's in the IORegistry

The answer turned out to be one ioreg away. Try this on your Mac:

ioreg -r -c AppleDeviceManagementHIDEventService -l | grep -E '"(Product|ColorID)"'

Mine prints (I trimmed my name out of the device name):

"Product" = "Apple Internal Keyboard / Trackpad"
"ColorID" = 1
"ColorID" = 34
"Product" = "Magic Mouse"

AppleDeviceManagementHIDEventService is the service the HID driver publishes for each Magic accessory, and the built-in keyboard and trackpad get one too. Besides ColorID it carries the Bluetooth address, the product ID and the battery percentage that macOS shows. It's plain IOKit and needs no entitlement or permission prompt.

So my black mouse is 34. What does 34 mean?

macOS's banner reads the same number

When I reconnected the mouse with Console open, loginwindow logged the banner request:

deviceIdentifiers: ["color": 34, "productID": 617]

617 is 0x0269, the Magic Mouse 2. So the banner uses the same pair, product ID plus colour code, to pick its picture.

Apple ships the lookup table as a plist

The pictures live in CoreBluetoothUI, and next to them are small plists that map those pairs to image names. My mouse, 0x0269, isn't in any of them, but the newer USB-C Magic Mouse (0x0323) is, and you can read its file with nothing but plutil:

plutil -p /System/Library/PrivateFrameworks/CoreBluetoothUI.framework/Resources/AssetPaths-A165.plist
{
  "0x0323" => {
    "Color" => {
      "0x05" => "A125-Black.icns"
      "0x09" => "A125-Black.icns"
      "0x22" => "A125-Black.icns"
    }
    "DisplayName" => "Magic Mouse"
    "ImageName" => "A125-White.icns"
    "Name" => "Magic Mouse"
  }
}

0x22 is 34. Codes 0x05, 0x09 and 0x22 get the black picture, and anything else falls back to the white one. The image names carry the colour, and they get specific: the Magic Trackpad alone has D67-Black, D67-BlackRounded, D67-White and D67-WhiteRounded, with the Rounded pictures going to the newer codes.

There are 19 of these files on macOS 27, and they don't cover every product. For the rest, CoreBluetoothUI has a helper, CBAssetHelper getImageURLForAppleProductID:andColor:, that answers the same question. Asked about 0x0269 with 0x22, it gives the same A125-Black picture. I called it once, on my own machine, for every product and code, and turned the answers into a static table. The shipping app never calls anything private. It reads ColorID and looks it up.

One trap: a colour code means nothing without its product. On Beats Fit Pro, 0x02 is Stone Purple. On Beats Studio Buds, 0x02 is red. So it's never "colour 34", only "colour 34 of a Magic Mouse".

AirPods Max and Beats say it out loud

I found no ColorID for headphones, but AirPods Max and Beats broadcast their colour. When AirPods Max or Beats are nearby, they send a Bluetooth LE "proximity pairing" advertisement: Apple's manufacturer data (company ID 0x004C), record type 0x07. That record carries the model, battery and case status, a lid counter, and one byte that is the same per-product colour code.

A green AirPods Max announces 0x11, and the 0x11 entry in Apple's AirPods Max table is green. The layout of these Continuity messages comes from public reverse-engineering such as furiousMAC/continuity, not from documentation, so the app logs every record raw in case Apple changes it.

Listening for that needs Bluetooth permission. Lunille only scans when one of these headphones connects, and stops after a few seconds.

The thing I couldn't do

Once Lunille drew the right colour, I wanted macOS 27's own accessory banner gone, so you'd see one card and not two. I couldn't make that happen.

The banner starts in loginwindow (BezelServices). Control Center builds it, and a MenuBarAgent window shows it, with an accessibility identifier starting with accessory-system-banner. Through the accessibility API, setting its position returns success and the window snaps straight back. Size and hidden aren't settable. Pressing it fails. The proper client API needs a private entitlement (com.apple.private.system-banner-client), and there's no setting or defaults key to turn it off. So for now both show up.

Help me fill the table

I've only confirmed 34 on real hardware, because that's the accessory I own. The rest of my table comes from Apple's plists. If you have a Magic Keyboard in one of the iMac colours, a white Magic Trackpad or an older silver keyboard, I'd love to know what ioreg prints for it, with the product ID. You'll find it with the same command plus ProductID in the grep.


Lunille is a notch app for macOS 14 and later, with a little moon called Luni who reacts to what your Mac is doing. It has a 14-day free trial at lunille.com.