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))
}