Coder Social home page Coder Social logo

brununc / theme-converter-for-vs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/theme-converter-for-vs

0.0 0.0 0.0 767 KB

CLI tool that allows you to convert your VS Code color theme to a VS 2022 color theme.

License: MIT License

C# 97.37% C++ 0.31% CSS 0.20% HTML 0.23% JavaScript 1.35% Visual Basic .NET 0.53%

theme-converter-for-vs's Introduction

Theme Converter for Visual Studio

Theme Converter is a CLI tool which allows you to convert your VS Code theme to work in Visual Studio. It's a simple tool that maps the colors of a theme to Visual Studio. Themes can be packaged into VSIXs and uploaded to the Marketplace so that more people can use your theme! This allows developers who use Visual Studio, or use both VS Code and Visual Studio, to quickly get access to a wide range of fun and interesting themes!

Here's a quick overview on how the Theme Converter works: Tutorial on converting a theme

Our community of authors have already converted a handful of VS Code themes to work in Visual Studio. Feel free to take a look here.

Prerequisites

  1. VS Code
  2. VS 2022 Preview 3 or later for best results
  3. The following individual components can be installed via the Visual Studio installer: .NET 5.0 Runtime, .NET Desktop development workload, and Visual Studio extension development workload.

image

Instructions

Using the tool

  1. Open command line in Admin mode.
  2. Clone the repo
  3. Go to <your_clone_path>\ThemeConverter\ThemeConverter and build the converter project with dotnet build ThemeConverter.csproj.
  4. Go to <your_clone_path>\ThemeConverter\ThemeConverter\bin\Debug\net5.0.
  5. Get the theme file with steps described in section Getting a theme's json file
  6. Run ThemeConverter.exe -h to see the usage of the tool and use the tool according to your needs.
    • If you want to convert a theme and patch it to a target VS:

      • Run ThemeConverter.exe -i <path_to_theme_json> -t <target_vs_installation_path>
      • Example: ThemeConverter.exe -i "C:\myTheme\TestTheme.json" -t "C:\Program Files\Microsoft Visual Studio\2022\Preview". This command will convert the TestTheme, patch the generated json to the target VS and launch the VS with the converted theme.
      • Note: the VS installation path can be found in your VS installer (the location field on the modify page).
      • Now you can see the your converted theme under Tools -> Themes! Enjoy!
    • If you just want to convert a theme and get the generated pkgdef:

      • Run ThemeConverter.exe -i <path_to_theme_json> -o <output_path>
      • Example: ThemeConverter.exe -i "C:\myTheme\TestTheme.json" -o "C:\myTheme\results". This command will convert the theme and the generated pkgdef will be C:\myTheme\results\TestTheme.pkgdef.

Getting a theme's json file

  1. Open VS Code.
  2. Install the desired color theme and switch to this theme in VS Code. Please note that this tool will not convert icon themes.
  3. “Ctrl + Shift + P” and run “Developer: Generate Color Theme from current settings.”
  4. In the generated JSON, uncomment all code. When you uncomment, please be careful about missing commas! Make sure the JSON is valid.
  5. Save this as a “JSON” file for the conversion, using the theme's name as the file name. Please ensure that the file’s extension is .json. (The file shouldn’t be saved as a JSONC file.)
  6. Note: Because some part of VS UI does not support customized alpha channel, we recommend reducing the usage of not fully opaque colors for better conversion result.

Creating a VSIX for the new theme

This section describes how you can create a VSIX with the converted theme for publishing and sharing.

  1. In VS 2022, create a new "Empty VSIX Project."
  2. Select the project node and open the "Add existing Item" window: Use "Shift + Alt + A" or right-click on the project node, select Add > Existing Item.
  3. Set filter to All Files (.) and select the converted .pkgdef file(s) that you want to include in this VSIX.
  4. Select the newly added pkgdef file in the Solution Explorer and open the Properties window. If the Properties window is not already open, navigate to the View menu at the top > Properties Window.

blueReadme_propertieswindow

  1. Set Copy to Output Directory to Copy always.
  2. Set Include in VSIX to true.
  3. Open the source.extension.vsixmanifest file, then select Assets, select New.
  4. Set Type to Microsoft.VisualStudio.VsPackage, and Source to File on filesystem.
  5. Select Browse and select the .pkgdef you added. Select OK.
  6. Edit other fields in the vsixmanifest as desired (author, version, company, etc).
  7. Build solution and you now have a vsix in the output folder! Your new theme is most compatible with Visual Studio 2022 Preview 3 and up.

Removing a converted theme from VS

  1. Open target VS and switch to some theme that will not be deleted (like Blue theme).
  2. Go to <vs_install_dir>\Common7\IDE\CommonExtensions\Platform. e.g: C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Platform and delete the pkgdef of the theme that the you want to remove (The name of the pkgdef will match the name of the theme).
  3. Open Developer Command Prompt of the target VS and run devenv /updateConfiguration.
  4. Launch VS again, and the themes should now be removed.

Support

How to file issues and get help

This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new Issue.

Microsoft Support Policy

Support for this project is limited to the resources listed above.

Contributing

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 https://cla.opensource.microsoft.com.

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 [email protected] with any additional questions or comments.

Trademarks

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.

theme-converter-for-vs's People

Contributors

kettty avatar gracegtaylor avatar nestevez avatar microsoftopensource avatar microsoft-github-operations[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.