1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-25 19:42:42 +03:00

tab colors

This commit is contained in:
Eugene Pankov 2018-12-02 16:41:17 +01:00
parent 867ddb4809
commit 8800614bff
3 changed files with 27 additions and 1 deletions

View File

@ -13,6 +13,7 @@ export abstract class BaseTabComponent {
hasFocus = false hasFocus = false
hasActivity = false hasActivity = false
hostView: ViewRef hostView: ViewRef
color: string = null
protected titleChange = new Subject<string>() protected titleChange = new Subject<string>()
protected focused = new Subject<void>() protected focused = new Subject<void>()
protected blurred = new Subject<void>() protected blurred = new Subject<void>()

View File

@ -1,4 +1,7 @@
.progressbar([style.width]='progress + "%"', *ngIf='progress != null') .progressbar([style.width]='progress + "%"', *ngIf='progress != null')
.index(#handle) {{index + 1}} .index(
#handle,
[style.background-color]='tab.color',
) {{index + 1}}
.name([title]='tab.customTitle || tab.title') {{tab.customTitle || tab.title}} .name([title]='tab.customTitle || tab.title') {{tab.customTitle || tab.title}}
button((click)='app.closeTab(tab, true)') &times; button((click)='app.closeTab(tab, true)') &times;

View File

@ -7,6 +7,16 @@ import { ElectronService } from '../services/electron.service'
import { AppService } from '../services/app.service' import { AppService } from '../services/app.service'
import { HostAppService, Platform } from '../services/hostApp.service' import { HostAppService, Platform } from '../services/hostApp.service'
const COLORS = [
{ name: 'No color', value: null },
{ name: 'Blue', value: '#0275d8' },
{ name: 'Green', value: '#5cb85c' },
{ name: 'Orange', value: '#f0ad4e' },
{ name: 'Purple', value: '#613d7c' },
{ name: 'Red', value: '#d9534f' },
{ name: 'Yellow', value: '#ffd500' },
]
@Component({ @Component({
selector: 'tab-header', selector: 'tab-header',
template: require('./tabHeader.component.pug'), template: require('./tabHeader.component.pug'),
@ -87,6 +97,18 @@ export class TabHeaderComponent {
} }
}) })
}, },
{
label: 'Color',
sublabel: COLORS.find(x => x.value === this.tab.color).name,
submenu: COLORS.map(color => ({
label: color.name,
type: 'radio',
checked: this.tab.color === color.value,
click: () => this.zone.run(() => {
this.tab.color = color.value
}),
})),
}
]) ])
let process = await this.tab.getCurrentProcess() let process = await this.tab.getCurrentProcess()