Skip to content

Improve naming and documentation around attribute data #2603

@Tyriar

Description

@Tyriar

Current state:

/** Attribute data */
export interface IAttributeData {
fg: number;
bg: number;
clone(): IAttributeData;
// flags
isInverse(): number;
isBold(): number;
isUnderline(): number;
isBlink(): number;
isInvisible(): number;
isItalic(): number;
isDim(): number;
// color modes
getFgColorMode(): number;
getBgColorMode(): number;
isFgRGB(): boolean;
isBgRGB(): boolean;
isFgPalette(): boolean;
isBgPalette(): boolean;
isFgDefault(): boolean;
isBgDefault(): boolean;
// colors
getFgColor(): number;
getBgColor(): number;
}

Problems:

  • fg and bg are very ambiguous
  • getFgColor and getBgColor return a number, not an IColor
  • Can we improve getFgColorMode and getBgColorMode to return a type ColorMode = CM_DEFAULT | CM_P16 | CM_P256 | CM_RGB instead of number?
  • This whole interface could do with some detailed docs, especially since it's probably going to get exposed in xterm.d.ts in Add foreground/background color support for SerializeAddon #2369

Metadata

Metadata

Assignees

Labels

type/debtTechnical debt that could slow us down in the long run

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions