schema: add support for Visual Studio Code color picker #4587

Closed
opened 2026-01-30 23:51:16 +00:00 by claunia · 4 comments
Owner

Originally created by @mveril on GitHub (Oct 22, 2019).

Environment

Windows build number: 10.0.19002.0
Windows Terminal version (if applicable): 0.5.2762.0 from the Microsoft Store
 

Any other software?
Visual Studio Code version : 1.39.2

Steps to reproduce

Open the profile.json in Visual Studio Code and see the behavior of color setting like profile background.

Expected behavior

When I open the profile.json in VSCode and I want to set a color, it may be better if the color can be edited with the VSCode colorpcker.
It's can be obtained by set format: color in the json scheme, but I don't know how to disable alpha and only support "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$" style.
image

Actual behavior

The color must be set manually with the #rrggbb code
Here an example.
image
Thank you

Originally created by @mveril on GitHub (Oct 22, 2019). # Environment ```none Windows build number: 10.0.19002.0 Windows Terminal version (if applicable): 0.5.2762.0 from the Microsoft Store Any other software? Visual Studio Code version : 1.39.2 ``` # Steps to reproduce Open the `profile.json` in Visual Studio Code and see the behavior of color setting like profile `background`. # Expected behavior When I open the `profile.json` in VSCode and I want to set a color, it may be better if the color can be edited with the VSCode colorpcker. It's can be obtained by set `format: color` in the json scheme, but I don't know how to disable alpha and only support `"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"` style. ![image](https://user-images.githubusercontent.com/15073055/67272385-b6d5ba80-f4bc-11e9-9a15-512ff3ca13c0.png) # Actual behavior The color must be set manually with the `#rrggbb` code Here an example. ![image](https://user-images.githubusercontent.com/15073055/67271655-3f535b80-f4bb-11e9-8aeb-e41a0aa24c05.png) Thank you
Author
Owner

@carlos-zamora commented on GitHub (Oct 22, 2019):

That’s convenient haha. I wonder if our settings parser supports the alpha values? If it does, it might be just an update to the schema then.

@carlos-zamora commented on GitHub (Oct 22, 2019): That’s convenient haha. I wonder if our settings parser supports the alpha values? If it does, it might be just an update to the schema then.
Author
Owner

@mveril commented on GitHub (Oct 22, 2019):

That’s convenient haha. I wonder if our settings parser supports the alpha values? If it does, it might be just an update to the schema then.

Thank you.
OK alpha don't work and also may be confusing, but it may be possible to disable alpha or specify the color syntax in the json schema. I don't know.

@mveril commented on GitHub (Oct 22, 2019): > That’s convenient haha. I wonder if our settings parser supports the alpha values? If it does, it might be just an update to the schema then. Thank you. OK alpha don't work and also may be confusing, but it may be possible to disable alpha or specify the color syntax in the json schema. I don't know.
Author
Owner

@TheBrain0110 commented on GitHub (Nov 12, 2019):

Fun fact: The color syntax is already specified in the json schema to not allow alpha values. It doesn't stop VSCode's color picker from letting you pick a color with an alpha channel, but then it marks the line with a warning that it doesn't conform to the schema, which seems like a sufficient solution.

d2ca3c1fb0/doc/cascadia/profiles.schema.json (L5-L10)

Making the VSCode color picker work was a single line, which I just did for myself before even looking through the existing issues. See my PR #3530

5894a3a166/doc/cascadia/profiles.schema.json (L5-L11)

@TheBrain0110 commented on GitHub (Nov 12, 2019): Fun fact: The color syntax is *already* specified in the json schema to not allow alpha values. It doesn't stop VSCode's color picker from letting you pick a color with an alpha channel, but then it marks the line with a warning that it doesn't conform to the schema, which seems like a sufficient solution. https://github.com/microsoft/terminal/blob/d2ca3c1fb06779dc2fa828d0205122f4b2acf5f4/doc/cascadia/profiles.schema.json#L5-L10 Making the VSCode color picker work was a single line, which I just did for myself before even looking through the existing issues. See my PR #3530 https://github.com/microsoft/terminal/blob/5894a3a166e80873652cc4a62ad0c7d74ad27fd0/doc/cascadia/profiles.schema.json#L5-L11
Author
Owner

@mveril commented on GitHub (Nov 17, 2019):

Thank you @TheBrain0110 it's work fine ! Unfortunately the alpha slider cannot be disabled on VSCode

@mveril commented on GitHub (Nov 17, 2019): Thank you @TheBrain0110 it's work fine ! Unfortunately the alpha slider cannot be disabled on VSCode
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4587