This mostly worked before, but clearColor made the assumption that the colors were always in #RRBBGG format. See the discussion here: https://github.com/xtermjs/xterm.js/pull/1327#issuecomment-374812842 This changes the internal representation of a color so that we hold onto into an object containing the original css string along with an RGBA value encoded as a 32-bit uint. clearColor can then use that RGBA representation. Additionally, this deduplicates some code between ColorManager and Terminal. Terminal was generating the 256 ansi colors the same way ColorManager was, so this just makes Terminal use the same constant.
19 lines
343 B
TypeScript
19 lines
343 B
TypeScript
/**
|
|
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
* @license MIT
|
|
*/
|
|
|
|
export interface IColor {
|
|
css: string;
|
|
rgba: number; // 32-bit int with rgba in each byte
|
|
}
|
|
|
|
export interface IColorSet {
|
|
foreground: IColor;
|
|
background: IColor;
|
|
cursor: IColor;
|
|
cursorAccent: IColor;
|
|
selection: IColor;
|
|
ansi: IColor[];
|
|
}
|