Making it clearer when the extension is recording

Profile Picture
Published on Sep 4, 2019
master18 days ago
Commit message

Add colors so people notice when is recording

extension-vsc/src/status.ts
11import * as vscode from 'vscode';
22
3const workbenchConfig = vscode.workspace.getConfiguration('workbench');
4
35function clean(x: number) {
46 let res = `${Math.trunc(x)}`;
57 if (res.length < 2) {
68 res = `0${res}`;
79 }
810 return res;
911}
1012
1113class StatusBar {
1214
1315 private item: vscode.StatusBarItem;
1416 timeout: NodeJS.Timer | null = null;
1517 counting = false;
18 blink;
19 shouldBlink = false;
1620
1721 constructor() {
1822 this.item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
...
3842 }
3943
4044 stop() {
45 clearInterval(this.blink)
46 workbenchConfig.update('colorCustomizations', undefined, true)
4147 this.recordingStopped();
4248 this.item.command = 'gitduck.record';
4349 this.item.text = '$(triangle-right) Start GitDuck';
...
6773 }
6874
6975 start() {
76 this.blink = setInterval(() => {
77 this.shouldBlink = !this.shouldBlink
78 if (!this.shouldBlink) {
79 return workbenchConfig.update('colorCustomizations', undefined, true)
80 }
81
82 workbenchConfig.update('colorCustomizations', {
83 'activityBar.background': '#ff1512',
84 'titleBar.activeBackground': '#ff1512',
85 'titleBar.inactiveBackground': '#ff1512',
86 'statusBar.background': '#ff1512',
87 'statusBar.foreground': '#ff1512',
88 'statusBar.border': '#ff1512',
89 'statusBar.debuggingBackground': '#ff1512',
90 'statusBar.debuggingForeground': '#ff1512',
91 'statusBar.debuggingBorder': '#ff1512',
92 'statusBar.noFolderForeground': '#ff1512',
93 'statusBar.noFolderBackground': '#ff1512',
94 'statusBar.noFolderBorder': '#ff1512',
95 'statusBarItem.activeBackground': '#ff1512',
96 'statusBarItem.hoverBackground': '#ff1512',
97 'statusBarItem.prominentForeground': '#ff1512',
98 'statusBarItem.prominentBackground': '#ff1512',
99 'statusBarItem.prominentHoverBackground': '#ff1512',
100 }, true);
101 }, 300);
70102 this.item.command = 'gitduck.stop';
71103 this.item.text = '$(primitive-square) GitDuck stream';
72104 this.item.color = '#FFEB3B';
...