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.1.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.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ds4color-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0cad53cabde25d34d1d93cebe2441154422e9126e6cd70ee1bdb2f04e0b89b8e
MD5 cc2589f4968f0773b9026944c1dc2bbd
BLAKE2b-256 c11f0d804ca7e05679463134836b6ee67f017715d3fd43c04350f54c9837e4a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ds4color-1.0.1.tar.gz:

Publisher: publish.yml on bitmap4/ds4-lightbar-macos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

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

File hashes

Hashes for ds4color-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 741d053fa1bf8c8a2075dd617cac3a637a3f2123147b477122ff429a22898aea
MD5 61cddf221b3707700c1908e8d1ec0661
BLAKE2b-256 1826de5a76d840a93134f50cbcc9f5d08311e39bf30bca590dca7f2f8df05621

See more details on using hashes here.

Provenance

The following attestation bundles were made for ds4color-1.0.1-py3-none-any.whl:

Publisher: publish.yml on bitmap4/ds4-lightbar-macos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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