Skip to content

Automatically change VS Code theme along with Omarchy themes - #800

Merged
dhh merged 7 commits into
omacom:devfrom
OmarSkalli:vscode-themes
Sep 15, 2025
Merged

dhh merged 7 commits into
omacom:devfrom
OmarSkalli:vscode-themes

Conversation

@OmarSkalli

Copy link
Copy Markdown
Contributor

Adding support for VS Code themes to get updated along with Omarchy themes.

How it works:

  • Each theme defines a 'vscode.json` with the theme name & extension

When changing theme:

  • lookup extension
  • install it if user doesn't already have it installed
  • update vscode config to set-up the new theme

Risks / Open questions:

  1. We're installing an extension on behalf of the user. Is that ok? should it be an opt-in, or an opt-out? is there a precent with nvim themes?

  2. We're updating vscode user config using a regex: not ideal. I would have preferred to use jq but it doesn't supprot jsonc (json with comments) which are fairly common for vscode user settings.

  3. Didn't find matching themes for all supported themes. Should all official omarchy themes have vs code support?

@rmacklin

Copy link
Copy Markdown
Contributor

See #719 (comment)

@darcy

darcy commented Aug 15, 2025 •

Copy link
Copy Markdown
Contributor

I took a different approach in #791 with Obsidian by trying to infer the colors from the Omarchy themes and make the Obsidian theme dynamic, but allow the Omarchy theme to have a obsidian.css too if they wanted. So regardless, any new theme would magically work.

Wonder if extracting that part out could be useful for more things like this and Zed? I got it to work pretty well.

@OmarSkalli

OmarSkalli commented Aug 15, 2025 •

Copy link
Copy Markdown
Contributor Author

I took a different approach in #791 with Obsidian by trying to infer the colors from the Omarchy themes and make the Obsidian theme dynamic, but allow the Omarchy theme to have a obsidian.css too if they wanted. So regardless, any new theme would magically work.

Wonder if extracting that part out could be useful for more things like this and Zed? I got it to work pretty well.

Oh interesting, I'll take a look.

After using this for change locally for a bit, I'm realizing some of these vs code themes, while matching in colors with the rest, aren't that great for me. It's actually a bit disruptive to my workflow, and breaks my habits if it's not a high quality theme.

That makes me hesitant about this change, especially without it being an opt-in (or at the very least having an opt-out) mechanism. Along with the comment in #719 (comment), I wonder if having theme hooks might be better to let people pick what they want.

It could work in a similar way to omarchy-theme-install where a git repo gets cloned in ~/.config/omarchy/theme-hooks/ and the theme switcher script just invokes installed hooks from there.

@darcy

darcy commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

Yeah - there was another proposal about this exact idea: #809

@Macho0x

Macho0x commented Aug 17, 2025

Copy link
Copy Markdown
Contributor

Question pls: let's say you have a default VSCode setup that you like which is separate from the Omarchy colour theme -- is the behaviour that every time you change Omarchy theme it will override your own VSCode theme (thus needing to manually change it back to your theme on every Omarchy theme change)?

@OmarSkalli

Copy link
Copy Markdown
Contributor Author

Question pls: let's say you have a default VSCode setup that you like which is separate from the Omarchy colour theme -- is the behaviour that every time you change Omarchy theme it will override your own VSCode theme (thus needing to manually change it back to your theme on every Omarchy theme change)?

In its current implementation, yes -- which isn't ideal of course. I could make it something that people opt into (e.g. via theme plugins idea discussed above).

A lot of it will depend on the direction Omarchy is taking with respect to theming apps, and VSCode specifically.

@dhh any guidance or recommendation here?

@dhh

dhh commented Aug 22, 2025

Copy link
Copy Markdown
Contributor

This is very nicely done! Super minimal and for the most popular editor. I'm inclined to take it. We had vscode themeing in Omakub too.

We don't have any way of opting out of theme changes for neovim. I think that probably just goes with the territory? But we could have a backdoor like ~/.local/state/omarchy/toggles/skip-vscode-theme-changes. If that file is present, we don't do it. Then we can just document it. Otherwise I'd take this!

@dhh

dhh commented Aug 22, 2025

Copy link
Copy Markdown
Contributor

Question: Do these themes work for cursor and other vscode forks as well?

@OmarSkalli
OmarSkalli force-pushed the vscode-themes branch 2 times, most recently from 5af51d4 to 9ac82df Compare August 26, 2025 04:29
@OmarSkalli

OmarSkalli commented Aug 26, 2025 •

Copy link
Copy Markdown
Contributor Author

But we could have a backdoor like ~/.local/state/omarchy/toggles/skip-vscode-theme-changes.

Added support for that, along with missing themes.

Question: Do these themes work for cursor and other vscode forks as well?

In theory, it should work if the path (and executable to list-extensions) is updated accordingly. I can probably add cursor in a separate PR and check that it works. At that point, I might also refactor the logic in its own omarchy-theme-update-vscode or something along those line?

Either way, this should be good to go. Thanks @dhh

@dhh
dhh changed the base branch from master to dev August 28, 2025 16:45
@OmarSkalli

Copy link
Copy Markdown
Contributor Author

@dhh when you have a moment, let me know if this looks good to merge. Thanks!

@dhh

dhh commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

This will make it into Omarchy 2.2 👌

@dhh dhh added this to the 3.0 milestone Sep 14, 2025
@dhh

dhh commented Sep 15, 2025

Copy link
Copy Markdown
Contributor

Testing this now and my vanilla code installation does not have "$HOME/.config/Code/User/settings.json". Is that something we have to initialize ourselves here?

@dhh
dhh merged commit d3304c4 into omacom:dev Sep 15, 2025
manuel1618 pushed a commit to manuel1618/omarchy that referenced this pull request Sep 15, 2025
)

* Automatically change VS Code theme along with Omarchy themes

* Create a way to skip vscode auto-theming

* Make theme setting resilient to different states of the settings.json

* Improve setting and removing theme and notify when waiting on install

* Explain what we're doing

* Extract dedicated bin for vscode theme change

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
@OmarSkalli

Copy link
Copy Markdown
Contributor Author

Thanks @dhh for the merge and updates to the PR.

hamidriaz1998 pushed a commit to hamidriaz1998/omarchy that referenced this pull request Sep 18, 2025
)

* Automatically change VS Code theme along with Omarchy themes

* Create a way to skip vscode auto-theming

* Make theme setting resilient to different states of the settings.json

* Improve setting and removing theme and notify when waiting on install

* Explain what we're doing

* Extract dedicated bin for vscode theme change

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
dhcrzf pushed a commit to dhcrzf/omarchy that referenced this pull request Sep 18, 2025
)

* Automatically change VS Code theme along with Omarchy themes

* Create a way to skip vscode auto-theming

* Make theme setting resilient to different states of the settings.json

* Improve setting and removing theme and notify when waiting on install

* Explain what we're doing

* Extract dedicated bin for vscode theme change

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants