Nondigestible Purple Mayonnaise

    TypeScript icon, indicating that this package has built-in type declarations

    0.1.0 • Public • Published


    This module can consume a VS Code color theme JSON file and output a complete list off all VS Code colors, with defaults and overrides filled in.


    Here's how you might load a VS Code theme in order to make the current document fully capable of styling code made to run in a VS Code webview:

    import { ColorTheme, getWebviewProperties } from '@vscode/theme-color-consumer';
    const myThemeJson = '';
    // Use .load() to load the json, passing in a fetcher function. Returns all
    // themes defined in the package.json.
    const themes = ColorTheme.load(myThemeJson, async url => {
      const res = fetch(url);
      return res.text();
    // Get the webview colors. Information about the font to use is not included
    // in themes and should be passed here as well:
    const webviewProps = getWebviewProperties(themes[0], myFontData);
    // This returns the 'style' property, as well as a class and data which should
    // be applied to the body: =;
    Object.assign(document.body.dataset, webviewProps.dataset);

    You can also get individual colors from themes in a strongly-typed wau, for example: = themes[0].getColor('editor.foreground').toString();



    1. Clone VS Code somewhere (by default, in a vscode folder beside this repo)
    2. Set up VS Code, see its contributing guide
    3. Clone this repo, and run yarn to install dependencies.
    4. Run yarn extract [../path/to/vscode] to create a mapping.js file


    This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit

    When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

    This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.


    This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.




    npm i @vscode/theme-color-consumer

    DownloadsWeekly Downloads






    Unpacked Size

    174 kB

    Total Files


    Last publish


    • lramos15
    • sbatten
    • aweinand
    • hticehurst
    • rchiodo
    • rebornix
    • bpasero
    • raymondzhao
    • mistople
    • kaimaetzel
    • connor.peet
    • roblourens
    • chrmarti
    • tyriar
    • jrieken
    • alexandrudima
    • tylerl0706
    • miguelsolorio
    • deepak_robo
    • aeschli