# linux-bsod

Full-screen Linux DRM Panic / systemd-bsod blue screen Canvas library.

## Install

```bash
npm install linux-bsod
```

## Usage

```js
import { renderLinuxBSOD, mountLinuxBSOD } from 'linux-bsod';

// Render a canvas
const canvas = await renderLinuxBSOD(1920, 1080, {
  qr: 'https://kernel.org/panic?err=0x00000001',
  title: 'KERNEL PANIC!'
});

// Mount to body with auto-resize (returns unmount function)
const unmount = mountLinuxBSOD(document.body, {
  qr: 'https://kernel.org/panic',
  message: 'Attempted to kill the idle task!'
});

// Cleanup
unmount();
```

> The font is fixed to `Web437 IBM VGA` and loaded automatically from a
> built-in CDN URL. To use a different `Web437 IBM VGA` font file (e.g. the
> 8x8 variant), pass its URL via `fontUrl`:
> ```js
> mountLinuxBSOD(document.body, {
>   fontUrl: 'https://example.com/Web437_IBM_VGA_8x8.woff',
>   message: 'Attempted to kill the idle task!'
> });
> ```

## API

### `renderLinuxBSOD(width, height, options?)`

Returns `Promise<HTMLCanvasElement>`.

| Param | Type | Description |
|-------|------|-------------|
| `width` | `number \| null` | Canvas width in px, or `null` for `window.innerWidth` |
| `height` | `number \| null` | Canvas height in px, or `null` for `window.innerHeight` |
| `options` | `LinuxBSODOptions` | See below |

### `mountLinuxBSOD(container, options?)`

Mounts a full-screen canvas to `container` and auto-updates on window resize.

Returns an unmount function.

### Options

| Key | Default | Description |
|-----|---------|-------------|
| `fontUrl` | Built-in CDN `Web437_IBM_VGA_8x16.woff` | A `Web437 IBM VGA` font file URL. The font family is fixed to `Web437 IBM VGA` |
| `fontSize` | `16` | Font size in px for the TUX ASCII art and all text |
| `qr` | `"KERNEL PANIC"` | Content encoded in QR code |
| `message` | Same as `qr` | Body text displayed below QR code (auto-wrapped) |
| `title` | `"KERNEL PANIC!"` | Title text |
| `subtitle` | `"Please reboot your computer."` | Subtitle text |
| `bgColor` | `"#0048a8"` | Background color |
| `textColor` | `"#ffffff"` | Text color |
