Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change vscode's color theme using the the CLI? (`code` command)

Is it even possible to change the colour theme using the CLI? I went through the doc but could not find anything that matches this requirement.

I am working on a personal project where I am adding a cron job to switch the theme of my computer.

like image 488
Vandan Rogheliya Avatar asked May 21 '26 15:05

Vandan Rogheliya


1 Answers

It's not possible to change settings using the code command, but instead you could use sed to edit settings.json like so:

sed -i -e 's/"workbench.colorTheme": ".*"/"workbench.colorTheme": "Visual Studio Dark"/g' "$HOME/.config/Code/User/settings.json"
  • "workbench.colorTheme": ".*" is the regular expression (regex) to replace.
  • "workbench.colorTheme": "Visual Studio Dark" is the replacement string. Change Visual Studio Dark to your desired theme.
  • $HOME/.config/Code/User/settings.json is the path to your settings.json
like image 186
fn control option Avatar answered May 24 '26 06:05

fn control option



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!