When vscode starts, status bar color has to be setup along with specific environment variable. I have env.js
file and there is environment variable in that file.
env.js
...
const env = 'api.test.co.kr';
...
In above url, test
could be prod
or qa
or local
. From this context, I wanna change status bar color per this value on startup. I searched many extensions, but couldn't find. It means that like below.
test
: green prod
: blue qa
: red local
: black Question
To achieve this behavior, do I have to make vscode extension on my own? If not, how can I setup this behaviour?
To achieve this behavior, do I have to make vscode extension on my own?
Yes, to dynamically update the statusBar conditionally, you would need to create an extension or use an existing one that offers this functionality.
Settings specifically doesn't support if-else
-like control flow
At this time there is no native support for conditional color customizations, but for those that don't know, you can use a setting property workbench.colorCustomizations.statusBar.background
to statically change it; which you can apply application-wide or to a specific workspace.
In your settings file:
"workbench.colorCustomizations": {
"statusBar.background": "#ff0000"
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.