0

I know I could probably set up an alias or such, but I'm really looking for a way to ensure that VSCode will always start using a specific parameter, regardless of how it was invoked. Without having to set up alias, modify shortcuts, and in general try and solve this problem in a hundred different places.

I need this because VSCode, despite reporting fixes to the contrary, fails to select a proper palette when executed on a HDR enabled display.

It looks "dim".

enter image description here

Now I know how to make it look ok. If I start it as code --force-color-profile srgb, everything clears up and it looks like this.

enter image description here

Much better.

But I don't want to have to type this every time. And an alias would not help, when code is being executed from an external tool.

Is there a way to force this setting into VSCode in any and all instances?

1

Warning: The procedure requires to change an very integral file in VSCode installation. Editing this file with wrong JavaScript code may break it. Backup the required file before doing any change further.

This procedure will apply on every Electron framework based applications. Because the --force-color-profile command line option is for Chromium. According to the docs:

Force all monitors to be treated as though they have the specified color profile. Accepted values are "srgb" and "generic-rgb" (currently used by Mac layout tests) and "color-spin-gamma24" (used by layout tests).

First close any running Visual Studio Code session. Open VSCode installation folder. Then go to resources > app > out folder. Open main.js file in any editor. Add this line:

app.commandLine.appendSwitch('force-color-profile', 'srgb');

This will append the command line to underlying Chromium engine. Now open VScode.

Source: Microsoft/Vscode: issue #65816

Further readings:

0

This is an (untested) hack, but can easily be undone:

  • Create a batch file (.bat) that contains the command

    start "" "C:\Program Files\Microsoft VS Code\Code.exe" --force-color-profile srgb
    

    (The path to code.exe might be different on your computer.)

  • Convert the file to an .exe called code.exe. See How can I convert a Windows batch script to a .exe?

  • In the folder C:\Program Files\Microsoft VS Code, rename code.exe and replace it by the above created file.

This might need to be repeated when/if you update Code to a new version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.