Class: Sixel
core/sixel.Sixel
Sixel class for terminal graphics
Table of contents
Constructors
Properties
Methods
- carriageReturn
- colorDefinition
- colorSelect
- display
- displayBuffer
- encodeRepeat
- encodeSixel
- generateTestPattern
- header
- isSixelData
- isSupported
- lineFeed
- parseInfo
- stripSixel
- terminator
Constructors
constructor
• new Sixel()
Properties
DCS
▪ Static Readonly DCS: "\u001bP"
Sixel escape sequence markers
Defined in
MIN_VERSION
▪ Static Readonly MIN_VERSION: 1189
Minimum CTerm version for Sixel support
Defined in
SIXEL_START
▪ Static Readonly SIXEL_START: "\u001bPq"
Defined in
ST
▪ Static Readonly ST: "\u001b\\"
Defined in
Methods
carriageReturn
▸ Static carriageReturn(): string
Generate carriage return (move to start of next sixel row)
Returns
string
Defined in
colorDefinition
▸ Static colorDefinition(index, r, g, b): string
Generate sixel color definition
Parameters
| Name | Type | Description |
|---|---|---|
index |
number |
Color index (0-255) |
r |
number |
Red (0-100) |
g |
number |
Green (0-100) |
b |
number |
Blue (0-100) |
Returns
string
Defined in
colorSelect
▸ Static colorSelect(index): string
Generate sixel color selection
Parameters
| Name | Type |
|---|---|
index |
number |
Returns
string
Defined in
display
▸ Static display(output, options): Promise<boolean>
Display a pre-rendered Sixel file
Parameters
| Name | Type |
|---|---|
output |
IQOutput |
options |
SixelOptions |
Returns
Promise<boolean>
Defined in
displayBuffer
▸ Static displayBuffer(output, data, x?, y?): boolean
Display sixel data from a buffer
Parameters
| Name | Type |
|---|---|
output |
IQOutput |
data |
Buffer |
x? |
number |
y? |
number |
Returns
boolean
Defined in
encodeRepeat
▸ Static encodeRepeat(count, bits): string
Encode repeated sixel character
Parameters
| Name | Type | Description |
|---|---|---|
count |
number |
Repeat count |
bits |
number |
6-bit value |
Returns
string
Defined in
encodeSixel
▸ Static encodeSixel(bits): string
Encode a sixel character A sixel character represents 6 vertical pixels
Parameters
| Name | Type | Description |
|---|---|---|
bits |
number |
6-bit value (0-63) representing pixel pattern |
Returns
string
Defined in
generateTestPattern
▸ Static generateTestPattern(width?, height?): string
Generate a simple test pattern Useful for testing sixel support
Parameters
| Name | Type | Default value |
|---|---|---|
width |
number |
60 |
height |
number |
36 |
Returns
string
Defined in
header
▸ Static header(aspectRatio?, bgSelect?, horizontalGrid?): string
Generate sixel header sequence
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
aspectRatio |
number |
0 |
Pixel aspect ratio (0=default, 1=1:1, 2=5:4, etc.) |
bgSelect |
number |
0 |
Background select (0=device default, 1=no change, 2=set to 0) |
horizontalGrid? |
number |
undefined |
Horizontal grid size |
Returns
string
Defined in
isSixelData
▸ Static isSixelData(data): boolean
Check if data appears to be sixel format
Parameters
| Name | Type |
|---|---|
data |
string | Buffer |
Returns
boolean
Defined in
isSupported
▸ Static isSupported(ctermVersion): boolean
Check if Sixel is supported based on CTerm version
Parameters
| Name | Type |
|---|---|
ctermVersion |
number |
Returns
boolean
Defined in
lineFeed
▸ Static lineFeed(): string
Generate line feed (move down one sixel row)
Returns
string
Defined in
parseInfo
▸ Static parseInfo(data): null | SixelImageInfo
Parse sixel image info from data Returns basic info about the sixel image
Parameters
| Name | Type |
|---|---|
data |
string | Buffer |
Returns
null | SixelImageInfo
Defined in
stripSixel
▸ Static stripSixel(data): string
Strip sixel data from a string (for text extraction)
Parameters
| Name | Type |
|---|---|
data |
string |
Returns
string
Defined in
terminator
▸ Static terminator(): string
Generate sixel terminator
Returns
string