(
base64Data: string,
options: {
width?: number
height?: number
filename?: string
} = {},
)
| 176 | * @returns The escape sequence string, or null if not supported |
| 177 | */ |
| 178 | export function renderInlineImage( |
| 179 | base64Data: string, |
| 180 | options: { |
| 181 | width?: number |
| 182 | height?: number |
| 183 | filename?: string |
| 184 | } = {}, |
| 185 | ): string | null { |
| 186 | const protocol = detectTerminalImageSupport() |
| 187 | |
| 188 | switch (protocol) { |
| 189 | case 'iterm2': |
| 190 | return generateITerm2ImageSequence(base64Data, { |
| 191 | width: options.width, |
| 192 | height: options.height, |
| 193 | name: options.filename, |
| 194 | }) |
| 195 | |
| 196 | case 'kitty': |
| 197 | return generateKittyImageSequence(base64Data, { |
| 198 | width: options.width, |
| 199 | height: options.height, |
| 200 | }) |
| 201 | |
| 202 | case 'sixel': |
| 203 | // Sixel is more complex and requires actual image decoding |
| 204 | // For now, return null and fall back to metadata display |
| 205 | return null |
| 206 | |
| 207 | case 'none': |
| 208 | default: |
| 209 | return null |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Get a user-friendly description of the terminal image support |
no test coverage detected