Skip to content

Commit

Permalink
Merge pull request #4327 from Tyriar/2603
Browse files Browse the repository at this point in the history
Improve IAttributeData jsdoc
  • Loading branch information
Tyriar committed Dec 18, 2022
2 parents 0981ca8 + 167765f commit b5e6066
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions src/common/Types.d.ts
Expand Up @@ -9,7 +9,7 @@ import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
import { IParams } from 'common/parser/Types';
import { ICoreMouseService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
import { IBufferSet } from 'common/buffer/Types';
import { UnderlineStyle } from 'common/buffer/Constants';
import { Attributes, UnderlineStyle } from 'common/buffer/Constants';

export interface ICoreTerminal {
coreMouseService: ICoreMouseService;
Expand Down Expand Up @@ -133,10 +133,24 @@ export interface IOscLinkData {
uri: string;
}

/** Attribute data */
/**
* An object that represents all attributes of a cell.
*/
export interface IAttributeData {
/**
* "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
* significant bits and additional flags in the remaining 8 bits.
*/
fg: number;
/**
* "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
* significant bits and additional flags in the remaining 8 bits.
*/
bg: number;
/**
* "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
* data is optional on a cell and encodes less common data.
*/
extended: IExtendedAttrs;

clone(): IAttributeData;
Expand All @@ -152,8 +166,17 @@ export interface IAttributeData {
isStrikethrough(): number;
isProtected(): number;

// color modes
/**
* The color mode of the foreground color which determines how to decode {@link getFgColor},
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
*/
getFgColorMode(): number;
/**
* The color mode of the background color which determines how to decode {@link getBgColor},
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
*/
getBgColorMode(): number;
isFgRGB(): boolean;
isBgRGB(): boolean;
Expand All @@ -163,8 +186,15 @@ export interface IAttributeData {
isBgDefault(): boolean;
isAttributeDefault(): boolean;

// colors
/**
* Gets an integer representation of the foreground color, how to decode the color depends on the
* color mode {@link getFgColorMode}.
*/
getFgColor(): number;
/**
* Gets an integer representation of the background color, how to decode the color depends on the
* color mode {@link getBgColorMode}.
*/
getBgColor(): number;

// extended attrs
Expand Down

0 comments on commit b5e6066

Please sign in to comment.