(attr: AttributeData, colors: ReadonlyColorSet | undefined)
| 116 | // get currently active background color from terminal |
| 117 | // also respect INVERSE setting |
| 118 | function extractActiveBg(attr: AttributeData, colors: ReadonlyColorSet | undefined): RGBA8888 { |
| 119 | let bg = 0; |
| 120 | if (!colors) { |
| 121 | // FIXME: theme service is prolly not available yet, |
| 122 | // happens if .open() was not called yet (bug in core?) |
| 123 | return bg; |
| 124 | } |
| 125 | if (attr.isInverse()) { |
| 126 | if (attr.isFgDefault()) { |
| 127 | bg = convertLe(colors.foreground.rgba); |
| 128 | } else if (attr.isFgRGB()) { |
| 129 | const t = (attr.constructor as typeof AttributeData).toColorRGB(attr.getFgColor()); |
| 130 | bg = toRGBA8888(...t); |
| 131 | } else { |
| 132 | bg = convertLe(colors.ansi[attr.getFgColor()].rgba); |
| 133 | } |
| 134 | } else { |
| 135 | if (attr.isBgDefault()) { |
| 136 | bg = convertLe(colors.background.rgba); |
| 137 | } else if (attr.isBgRGB()) { |
| 138 | const t = (attr.constructor as typeof AttributeData).toColorRGB(attr.getBgColor()); |
| 139 | bg = toRGBA8888(...t); |
| 140 | } else { |
| 141 | bg = convertLe(colors.ansi[attr.getBgColor()].rgba); |
| 142 | } |
| 143 | } |
| 144 | return bg; |
| 145 | } |
| 146 | |
| 147 | // rgba values on the color managers are always in BE, thus convert to LE |
| 148 | function convertLe(color: number): RGBA8888 { |
no test coverage detected