Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Theme Toggle

Theme switching one click away, in the bb sidebar footer.

  • Click — cycle to the next palette.
  • Hover and wait (600 ms) — the menu opens on its own, no click needed. Mouse only, and it closes again once the cursor leaves.
  • Hold (400 ms) or right-click — the same menu, for touch and for people who would rather ask for it.

The menu lists light / dark / system appearance and every palette on the host, including ones contributed by other plugins.

Install

bb plugin install git:https://github.com/xMinor-1/bb-plugins.git --plugin theme-toggle

How it works

server.ts exposes three RPC methods over bb.sdk.theme:

Method What it does
state active palette plus the full list (built-in, custom, plugin-provided)
cycle switches to the next palette
select applies a palette by id

The two settings live in different places, so the plugin touches both:

Setting Owner How the plugin changes it
Palette bb server (bb.sdk.theme) the RPC methods above
Light / dark / system browser (localStorage key bb.theme) written client-side, with a synthetic storage event so bb re-renders

sidebarFooterAction is rendered by the host, so the hold gesture is attached by a content script to the host's button (matched by its stable data-testid), and the menu is plain DOM positioned next to that button. It styles itself from the app's CSS custom properties, so it follows whichever palette is active.

Development

npm install
npx tsc --noEmit
bb plugin build .
bb plugin dev .

License

MIT — see LICENSE.