Per-session GenServer that holds the active rendering skin and notifies the running application on change.
The skin controls which character set Drafter.CharacterSet returns for every
widget lookup. Three built-in skins are available:
| Skin | Description |
|---|---|
:graphical | Unicode block + braille characters (default) |
:wireframe | Unicode box-drawing, block fill, minimal decoration |
:ascii | 7-bit ASCII only — maximum compatibility |
Switching skins at runtime causes all widgets to re-render using the new character set on the next frame.
Usage
Drafter.set_skin(:wireframe)
Drafter.set_skin(:ascii)
Drafter.set_skin(:graphical)
Drafter.SkinManager.get_current_skin()
Drafter.SkinManager.available_skins()
Summary
Functions
Returns the list of registered skin names.
Returns a specification to start this module under a supervisor.
The active skin atom.
Register the app loop process to receive {:skin_updated, skin} messages.
Switch the active skin, sending {:skin_updated, skin} to the registered app.
Start a skin manager.
Functions
@spec available_skins() :: [atom()]
Returns the list of registered skin names.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec get_current_skin() :: atom()
The active skin atom.
Reads the calling process's own :drafter_skin first, then asks its session's skin
manager, and finally falls back to :graphical when neither is set. Never raises,
unlike set_skin/1 and register_app/1.
@spec register_app(pid()) :: :ok
Register the app loop process to receive {:skin_updated, skin} messages.
Only one process is registered at a time; registering again replaces the previous one. Asynchronous.
@spec set_skin(atom()) :: :ok
Switch the active skin, sending {:skin_updated, skin} to the registered app.
Asynchronous. Any atom is accepted, including one available_skins/0 does not
list; character lookups then fall back to the built-in defaults. Resolved through
Drafter.Session.Context, so it raises when no skin manager is reachable.
@spec start_link(keyword()) :: GenServer.on_start()
Start a skin manager.
Options
:name- registered name. Default:nil, which starts it unnamed. Note this differs fromDrafter.ThemeManager.start_link/1, which defaults to its own module name.
Any other options are accepted and ignored; the starting skin is always
:graphical.