Approximate render of the saved ANSI bytes (mIRC palette).
{% set palette = ['#ffffff','#000000','#00007f','#009300',
'#ff0000','#7f0000','#9c009c','#fc7f00',
'#ffff00','#00fc00','#009393','#00ffff',
'#0000fc','#ff00ff','#7f7f7f','#d2d2d2'] %}
{% set bg_palette = palette[:8] %}
{% for r in range(grid.height or art.height) %}
{%- for c in range(grid.width or art.width) -%}
{%- set idx = r * (grid.width or art.width) + c -%}
{%- set cell = grid.cells[idx] if idx < (grid.cells|length) else None -%}
{{ (cell.c if cell else ' ') | escape }}
{%- endfor -%}