Using vscode built-in colour picker with JSON files

Viewed 621

I'm trying to get the built-in colour picker to work with json (webmanifest) files in the same way it works with vscode's own settings.json file to display inline colour blocks next to hex values.

A previous thread suggested creating a schema and using format: color in this schema. I've tried the example from the docs at https://code.visualstudio.com/docs/languages/json in settings.json, and though it does give code intellisense in my webmanifest doc, it still doesn't show colour values.

"json.schemas": [
    {
        "fileMatch": ["*.webmanifest"],
        "url": "https://json.schemastore.org/web-manifest",
        "properties": {
            "theme_color": {
                "format": "color"
            }
        }
    }
]

I can't find vscode's inbuilt json schema to see how it's done there. Any help would be greatly appreciated. Tom

UPDATE

This works after including the type:object pair. Still have a lot of work to do though.

"json.schemas": [
    {   
         "fileMatch": ["*.webmanifest"],
         "schema": {
             "type": "object",
             "properties": {
                 "theme_color" : {
                     "type": "string",
                     "description": "toolbar colour: hex only",
                     "format": "color-hex"
                 }
             }
         }
    }
]
1 Answers
Related