iniquity

A re-imagining of the iconic BBS software.

View on GitHub

Class: Sixel

core/sixel.Sixel

Sixel class for terminal graphics

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Sixel()

Properties

DCS

Static Readonly DCS: "\u001bP"

Sixel escape sequence markers

Defined in

core/src/sixel.ts:65


MIN_VERSION

Static Readonly MIN_VERSION: 1189

Minimum CTerm version for Sixel support

Defined in

core/src/sixel.ts:60


SIXEL_START

Static Readonly SIXEL_START: "\u001bPq"

Defined in

core/src/sixel.ts:67


ST

Static Readonly ST: "\u001b\\"

Defined in

core/src/sixel.ts:66

Methods

carriageReturn

Static carriageReturn(): string

Generate carriage return (move to start of next sixel row)

Returns

string

Defined in

core/src/sixel.ts:179


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

core/src/sixel.ts:158


colorSelect

Static colorSelect(index): string

Generate sixel color selection

Parameters

Name Type
index number

Returns

string

Defined in

core/src/sixel.ts:165


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

core/src/sixel.ts:79


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

core/src/sixel.ts:108


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

core/src/sixel.ts:204


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

core/src/sixel.ts:195


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

core/src/sixel.ts:291


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

core/src/sixel.ts:127


isSixelData

Static isSixelData(data): boolean

Check if data appears to be sixel format

Parameters

Name Type
data string | Buffer

Returns

boolean

Defined in

core/src/sixel.ts:272


isSupported

Static isSupported(ctermVersion): boolean

Check if Sixel is supported based on CTerm version

Parameters

Name Type
ctermVersion number

Returns

boolean

Defined in

core/src/sixel.ts:72


lineFeed

Static lineFeed(): string

Generate line feed (move down one sixel row)

Returns

string

Defined in

core/src/sixel.ts:186


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

core/src/sixel.ts:215


stripSixel

Static stripSixel(data): string

Strip sixel data from a string (for text extraction)

Parameters

Name Type
data string

Returns

string

Defined in

core/src/sixel.ts:282


terminator

Static terminator(): string

Generate sixel terminator

Returns

string

Defined in

core/src/sixel.ts:172