# `Mob.Theme.AdaptiveWatcher`
[🔗](https://github.com/genericjam/mob/blob/master/lib/mob/theme/adaptive_watcher.ex#L1)

GenServer that re-resolves the active theme when the OS appearance flips.

Started automatically by `use Mob.App`. Subscribes to `Mob.Device`
`:appearance` and, on `:color_scheme_changed`, calls `Mob.Theme.set/1`
again with whatever theme the app has registered as its "follow OS"
theme (via `register_adaptive/1`). If no adaptive theme is registered
the event is ignored — fixed themes stay put.

## Why a GenServer

`Mob.Theme.set/1` snapshots the theme into Application env at call
time; subsequent renders read from that env. To track an OS toggle
while the app is foregrounded, *something* has to listen for the
`:appearance` event and call `set/1` again. A singleton process
fits — apps don't need per-screen handlers, and the framework owns
the wiring end-to-end.

## Default registration

When `Mob.Theme.set(Mob.Theme.Adaptive)` is called, the watcher
picks `Mob.Theme.Adaptive` as the active follow-OS theme. To use a
custom adaptive theme module instead, call
`register_adaptive(MyApp.Theme.Adaptive)`.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `register_adaptive`

```elixir
@spec register_adaptive(module()) :: :ok
```

Register `module` as the app's follow-OS theme. Whenever a
`:color_scheme_changed` event arrives, the watcher calls
`Mob.Theme.set(module)` to re-resolve.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
