MCPcopy
hub / github.com/xtermjs/xterm.js / _updateAttrColor

Method _updateAttrColor

src/common/InputHandler.ts:2308–2318  ·  view source on GitHub ↗

* Helper to write color information packed with color mode.

(color: number, mode: number, c1: number, c2: number, c3: number)

Source from the content-addressed store, hash-verified

2306 * Helper to write color information packed with color mode.
2307 */
2308 private _updateAttrColor(color: number, mode: number, c1: number, c2: number, c3: number): number {
2309 if (mode === 2) {
2310 color |= Attributes.CM_RGB;
2311 color &= ~Attributes.RGB_MASK;
2312 color |= AttributeData.fromColorRGB([c1, c2, c3]);
2313 } else if (mode === 5) {
2314 color &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);
2315 color |= Attributes.CM_P256 | (c1 & 0xff);
2316 }
2317 return color;
2318 }
2319
2320 /**
2321 * Helper to extract and apply color params/subparams.

Callers 1

_extractColorMethod · 0.95

Calls 1

fromColorRGBMethod · 0.80

Tested by

no test coverage detected