Skip to main content

Set the DualShock 4 lightbar to a solid colour on macOS over USB or Bluetooth

Project description

ds4-lightbar-macos

A DualShock 4 connected to a Mac over Bluetooth never gets told what colour to make its lightbar, so it just pulses white forever even though it works fine. On a PS4 the console sends that command; macOS doesn't. This is a tiny tool that sends it, so the light goes solid instead.

It also sets the colour automatically every time the controller connects, over USB or Bluetooth, and only after it has read a real input report from the pad. That last part matters: if the light goes solid, the controller is genuinely connected and sending input. If it stays blinking white, something is wrong with the connection and you know not to trust it.

Install

Homebrew:

brew install bitmap4/tap/ds4color
ds4color enable

Or with pipx:

pipx install ds4color
ds4color enable

ds4color enable starts a small background agent that runs at login and sets the colour whenever the controller connects. ds4color disable stops it.

Usage

ds4color              # current setting and whether the pad is connected
ds4color blue         # pick a colour
ds4color blue 20      # colour at 20% brightness
ds4color 20           # just the brightness
ds4color 255 90 0     # custom rgb
ds4color night        # dim warm preset
ds4color day          # bright blue preset
ds4color list         # named colours
ds4color presets      # saved presets
ds4color save night   # save the current setting as a preset

Changes apply right away if the pad is connected, and the agent reuses them on every reconnect.

If you own more than one DS4 and want this to touch only one of them, connect that one and run ds4color bind. ds4color unbind goes back to matching any DualShock 4.

Config

~/.config/ds4color/config.json:

{
  "color": "blue",
  "brightness": 100,
  "controller_serial": null,
  "presets": {
    "day":   { "color": "blue", "brightness": 100 },
    "night": { "color": "warm", "brightness": 12 }
  }
}

controller_serial is the controller's Bluetooth MAC (the DS4 reports the same value over USB). Leave it null to match any DS4.

How it works

Setting the lightbar is a HID output report. Over USB it's report 0x05; over Bluetooth it's report 0x11 with a CRC32 the controller checks before it listens. The tool figures out which transport you're on by looking at the input report the pad sends back, then writes the matching one. That's the whole trick.

Uninstall

ds4color disable
brew uninstall ds4color   # or: pipx uninstall ds4color

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ds4color-1.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ds4color-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file ds4color-1.0.0.tar.gz.

File metadata

  • Download URL: ds4color-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ds4color-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e067ac4038e928ae73c5eabd9a2933ef329ddf88dd22c7893f8d05ce960926cf
MD5 dd224b2b5f96ad54de402cee8841b4fe
BLAKE2b-256 11607cbe84538b3739099165fb9987f57e1d39c7842e2ccbe927b181cbe21780

See more details on using hashes here.

File details

Details for the file ds4color-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ds4color-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ds4color-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa3a02578190042e0a8d1e71f31e4a8b96fec0e45d11e17e93c6af4c601ac86a
MD5 0ebe44ee9c4e80551774dc5ecd70c1b1
BLAKE2b-256 7484a5feeb22f422e097ae3e4cf27ff1ea932bd2dcac68fe19f42d44c6530699

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page