mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-04 14:04:56 +00:00
proper background when copying as HTML
This commit is contained in:
@@ -267,7 +267,7 @@ export class XTermFrontend extends Frontend {
|
|||||||
return html
|
return html
|
||||||
}
|
}
|
||||||
|
|
||||||
private getHexColor (mode: number, color: number): string {
|
private getHexColor (mode: number, color: number, def: string): string {
|
||||||
if (mode === Attributes.CM_RGB) {
|
if (mode === Attributes.CM_RGB) {
|
||||||
const rgb = AttributeData.toColorRGB(color)
|
const rgb = AttributeData.toColorRGB(color)
|
||||||
return rgb.map(x => x.toString(16).padStart(2, '0')).join('')
|
return rgb.map(x => x.toString(16).padStart(2, '0')).join('')
|
||||||
@@ -275,7 +275,7 @@ export class XTermFrontend extends Frontend {
|
|||||||
if (mode === Attributes.CM_P16 || mode === Attributes.CM_P256) {
|
if (mode === Attributes.CM_P16 || mode === Attributes.CM_P256) {
|
||||||
return this.configService.store.terminal.colorScheme.colors[color]
|
return this.configService.store.terminal.colorScheme.colors[color]
|
||||||
}
|
}
|
||||||
return 'transparent'
|
return def
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLineAsHTML (y: number, start: number, end: number): string {
|
private getLineAsHTML (y: number, start: number, end: number): string {
|
||||||
@@ -285,8 +285,8 @@ export class XTermFrontend extends Frontend {
|
|||||||
const cell = new CellData()
|
const cell = new CellData()
|
||||||
for (let i = start; i < end; i++) {
|
for (let i = start; i < end; i++) {
|
||||||
line.loadCell(i, cell)
|
line.loadCell(i, cell)
|
||||||
const fg = this.getHexColor(cell.getFgColorMode(), cell.getFgColor())
|
const fg = this.getHexColor(cell.getFgColorMode(), cell.getFgColor(), this.configService.store.terminal.colorScheme.foreground)
|
||||||
const bg = this.getHexColor(cell.getBgColorMode(), cell.getBgColor())
|
const bg = this.getHexColor(cell.getBgColorMode(), cell.getBgColor(), this.configService.store.terminal.colorScheme.background)
|
||||||
const style = `color: ${fg}; background: ${bg}; font-weight: ${cell.isBold() ? 'bold' : 'normal'}; font-style: ${cell.isItalic() ? 'italic' : 'normal'}; text-decoration: ${cell.isUnderline() ? 'underline' : 'none'}`
|
const style = `color: ${fg}; background: ${bg}; font-weight: ${cell.isBold() ? 'bold' : 'normal'}; font-style: ${cell.isItalic() ? 'italic' : 'normal'}; text-decoration: ${cell.isUnderline() ? 'underline' : 'none'}`
|
||||||
if (style !== lastStyle) {
|
if (style !== lastStyle) {
|
||||||
if (lastStyle !== null) {
|
if (lastStyle !== null) {
|
||||||
|
Reference in New Issue
Block a user