Status bar: setting invalid color sets opacity 100%. Fixes #115292

This commit is contained in:
Martin Aeschlimann 2021-01-28 17:33:42 +01:00
parent b8bff49c9a
commit e86befc8a9

View file

@ -894,7 +894,7 @@ class StatusbarEntryItem extends Disposable {
}
private applyColor(container: HTMLElement, color: string | ThemeColor | undefined, isBackground?: boolean): void {
let colorResult: string | null = null;
let colorResult: string | undefined = undefined;
if (isBackground) {
this.backgroundListener.clear();
@ -904,15 +904,15 @@ class StatusbarEntryItem extends Disposable {
if (color) {
if (isThemeColor(color)) {
colorResult = (this.themeService.getColorTheme().getColor(color.id) || Color.transparent).toString();
colorResult = this.themeService.getColorTheme().getColor(color.id)?.toString();
const listener = this.themeService.onDidColorThemeChange(theme => {
const colorValue = (theme.getColor(color.id) || Color.transparent).toString();
const colorValue = theme.getColor(color.id)?.toString();
if (isBackground) {
container.style.backgroundColor = colorValue;
container.style.backgroundColor = colorValue ?? '';
} else {
container.style.color = colorValue;
container.style.color = colorValue ?? '';
}
});
@ -927,9 +927,9 @@ class StatusbarEntryItem extends Disposable {
}
if (isBackground) {
container.style.backgroundColor = colorResult || '';
container.style.backgroundColor = colorResult ?? '';
} else {
container.style.color = colorResult || '';
container.style.color = colorResult ?? '';
}
}