demo D113
Terminal in htmx
A phosphor console: one hue, monospaced, status by brightness
theme: 'terminal'
This grid renders as a phosphor console: a single hue on a dark background, monospaced, with status shown by brightness rather than colour. It suits an operations or terminal aesthetic, proving the theme system reaches well beyond light and dark.
This is the htmx version. A server-rendered table is upgraded in place, so the page is readable before any script runs and gains the full grid when the module loads, which suits a progressively enhanced app.
The configuration
<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.107.0/lattice-grid.min.css">
<!-- A real, server-rendered table: readable with JavaScript off. data-field on
each header names the column that cell becomes, and data-id on each row is
the key the grid carries it under. -->
<table id="terminal-theme-table" data-lattice-grid>
<thead>
<tr>
<th data-field="service">Service</th>
<th data-field="team">Team</th>
<th data-field="owner">Owner</th>
<th data-field="region">Region</th>
<th data-field="active">Active</th>
<th data-field="deprecated">Deprecated</th>
<th data-field="version">Version</th>
</tr>
</thead>
<tbody>
<tr data-id="1"><td>svc-00001</td><td>Search</td><td>k.yilmaz</td><td>Malmö</td><td>false</td><td>false</td><td>1.2.10</td></tr>
<tr data-id="2"><td>svc-00002</td><td>Mobile</td><td>m.svensson</td><td>Leeds</td><td>true</td><td>false</td><td>2.3.6</td></tr>
<tr data-id="3"><td>svc-00003</td><td>Identity</td><td>j.okafor</td><td>Zürich</td><td>true</td><td>false</td><td>1.11.1</td></tr>
<!-- the rest of the rows, rendered by your server -->
</tbody>
</table>
<script type="module">
import { hydrateTable } from 'https://cdn.latticegrid.dev/lattice-grid@1.107.0/modules/htmx.esm.min.js';
// The markup carries the rows; a server-rendered table's column types are
// declared in the config hydrateTable takes. The grid replaces the table
// where it stood.
const grid = hydrateTable(document.getElementById('terminal-theme-table'), {
selection: 'multiple',
// A shipped theme, applied by name. Its tokens ride in the stylesheet the
// link above already loads, so nothing else is needed to switch the look.
theme: 'terminal',
columns: [
{ field: 'service', title: 'Service', layout: { pin: 'start', width: 140 } },
{ field: 'team', title: 'Team', filter: { type: 'set' } },
{ field: 'owner', title: 'Owner', filter: { type: 'set' } },
{ field: 'tier', title: 'Tier', cell: { decoration: 'pill', variant: { map: { gold: 'warning', silver: 'neutral', bronze: 'info' } } } },
{ field: 'state', title: 'State', cell: { decoration: 'dot', variant: { map: { healthy: 'success', degraded: 'warning', failing: 'danger', unknown: 'neutral' } } } },
{ field: 'region', title: 'Region', filter: { type: 'set' } },
{ field: 'active', title: 'Active', type: 'boolean' },
{ field: 'deprecated', title: 'Deprecated', type: 'boolean' },
{ field: 'version', title: 'Version', layout: { width: 100 } },
],
});
</script>
A monochrome terminal theme for a JavaScript data grid
The terminal theme strips colour down to a single hue on a dark background, rendering text, borders and status indicators as shades of one phosphor green (or amber, or white, depending on the palette chosen) rather than a mixed colour scale. Reach for it when a Lattice Grid instance sits inside a console-style tool, a log viewer, or any interface built to evoke a command-line session, where a conventional light-and-shade UI theme would clash with the surrounding chrome. Row state, sort direction and validation errors are still legible: instead of red and green, the theme encodes them as brightness steps, so a flagged row sits at full intensity while a muted or disabled one recedes toward the background. Set theme: 'terminal' to switch a grid over; the option takes effect immediately and does not require re-mounting the grid or reloading its data.
Because every element draws from one hue, the theme keeps contrast ratios stable across the interface: headers, focus rings and hover states each get their own brightness step, so the relationships between them hold even when a display’s saturation changes. Fonts render monospaced by default, matching a terminal-style layout and keeping numeric columns aligned without extra width padding. Switching themes is a style change only; row data, sort order and column widths carry over unaffected.
How do I make a JavaScript data grid look like a terminal?
Set the theme option to 'terminal' when creating the grid, or apply it later with the same property. The theme swaps colours and fonts for a single-hue, monospaced palette while leaving row data, sorting and column layout untouched, so it can be toggled alongside other themes without rebuilding the grid.