Packages

Terminal emulator library for the BEAM — libghostty-vt NIFs with OTP integration.

Retired package: Release invalid - Hex package omitted Ghostty.TTY backend modules; use 0.4.7.

Current section

Files

Jump to
ghostty priv ts util.ts
Raw

priv/ts/util.ts

import type { Color } from './types'
export function esc(s: string): string {
return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
}
export function rgb(color: Color): string {
return `rgb(${color[0]},${color[1]},${color[2]})`
}
export function clamp(value: number, min: number, max: number): number {
return Math.min(max, Math.max(min, value))
}