├── .editorconfig ├── .gitattributes ├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── Windows.runsettings │ └── build.yaml ├── .gitignore ├── LICENSE ├── README.md ├── SolutionColors.sln ├── art ├── border-settings.png ├── colors.png ├── context-menu-disable.png ├── context-menu-none.png ├── context-menu.png ├── custom-colors.png ├── options.png ├── solution-context-menu.png ├── solution-label.png ├── taskbar-icons.png ├── taskbar.png └── top.png ├── nuget.config ├── src ├── ColorCache.cs ├── ColorHelper.cs ├── Commands │ ├── CustomCommand.cs │ ├── OptionsCommand.cs │ ├── SetColorCommandFolder.cs │ └── SetColorCommandSolution.cs ├── ExtensionMethods │ ├── BrushExtensions.cs │ ├── SolutionExtensions.cs │ └── WpfExtensions.cs ├── GitHelper.cs ├── Options │ ├── BorderEditor.cs │ ├── BorderEditorDialog.Designer.cs │ ├── BorderEditorDialog.cs │ ├── BorderEditorDialog.resx │ ├── BorderSettings.cs │ ├── BorderTypeConverter.cs │ ├── EnumDescriptionConverter.cs │ ├── FileSelectorDialog.cs │ ├── General.cs │ └── TaskBarOptions.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ └── Icon.png ├── SolutionColors.csproj ├── SolutionColorsPackage.cs ├── Telemetry.cs ├── VSCommandTable.cs ├── VSCommandTable.vsct ├── source.extension.cs └── source.extension.vsixmanifest └── vs-publish.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome:http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Don't use tabs for indentation. 7 | [*] 8 | indent_style = space 9 | end_of_line = crlf 10 | # (Please don't specify an indent_size here; that has too many unintended consequences.) 11 | 12 | # Code files 13 | [*.{cs,csx,vb,vbx,xaml}] 14 | indent_size = 4 15 | 16 | # Xml project files 17 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] 18 | indent_size = 2 19 | 20 | # Xml config files 21 | [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] 22 | indent_size = 2 23 | 24 | # JSON files 25 | [*.json] 26 | indent_size = 2 27 | 28 | # Dotnet code style settings: 29 | [*.{cs,vb}] 30 | # Sort using and Import directives with System.* appearing first 31 | dotnet_sort_system_directives_first = true 32 | dotnet_separate_import_directive_groups = false 33 | 34 | # Avoid "this." and "Me." if not necessary 35 | dotnet_style_qualification_for_field = false : suggestion 36 | dotnet_style_qualification_for_property = false : suggestion 37 | dotnet_style_qualification_for_method = false : suggestion 38 | dotnet_style_qualification_for_event = false : suggestion 39 | 40 | # Use language keywords instead of framework type names for type references 41 | dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion 42 | dotnet_style_predefined_type_for_member_access = true : suggestion 43 | 44 | # Suggest more modern language features when available 45 | dotnet_style_object_initializer = true : suggestion 46 | dotnet_style_collection_initializer = true : suggestion 47 | dotnet_style_coalesce_expression = true : suggestion 48 | dotnet_style_null_propagation = true : suggestion 49 | dotnet_style_explicit_tuple_names = true : suggestion 50 | 51 | # Naming rules - async methods to be prefixed with Async 52 | dotnet_naming_rule.async_methods_must_end_with_async.severity = warning 53 | dotnet_naming_rule.async_methods_must_end_with_async.symbols = method_symbols 54 | dotnet_naming_rule.async_methods_must_end_with_async.style = end_in_async_style 55 | 56 | dotnet_naming_symbols.method_symbols.applicable_kinds = method 57 | dotnet_naming_symbols.method_symbols.required_modifiers = async 58 | 59 | dotnet_naming_style.end_in_async_style.capitalization = pascal_case 60 | dotnet_naming_style.end_in_async_style.required_suffix = Async 61 | 62 | # Naming rules - private fields must start with an underscore 63 | dotnet_naming_rule.field_must_start_with_underscore.severity = warning 64 | dotnet_naming_rule.field_must_start_with_underscore.symbols = private_fields 65 | dotnet_naming_rule.field_must_start_with_underscore.style = start_underscore_style 66 | 67 | dotnet_naming_symbols.private_fields.applicable_kinds = field 68 | dotnet_naming_symbols.private_fields.applicable_accessibilities = private 69 | 70 | dotnet_naming_style.start_underscore_style.capitalization = camel_case 71 | dotnet_naming_style.start_underscore_style.required_prefix = _ 72 | 73 | # CSharp code style settings: 74 | [*.cs] 75 | # Prefer "var" everywhere 76 | csharp_style_var_for_built_in_types =false:error 77 | csharp_style_var_when_type_is_apparent =false:error 78 | csharp_style_var_elsewhere =false:error 79 | 80 | # Prefer method-like constructs to have a block body 81 | csharp_style_expression_bodied_methods = false : none 82 | csharp_style_expression_bodied_constructors = false : none 83 | csharp_style_expression_bodied_operators = false : none 84 | 85 | # Prefer property-like constructs to have an expression-body 86 | csharp_style_expression_bodied_properties = true : none 87 | csharp_style_expression_bodied_indexers = true : none 88 | csharp_style_expression_bodied_accessors = true : none 89 | 90 | # Suggest more modern language features when available 91 | csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion 92 | csharp_style_pattern_matching_over_as_with_null_check = true : suggestion 93 | csharp_style_inlined_variable_declaration = true : suggestion 94 | csharp_style_throw_expression = true : suggestion 95 | csharp_style_conditional_delegate_call = true : suggestion 96 | 97 | # Newline settings 98 | csharp_new_line_before_open_brace = all 99 | csharp_new_line_before_else = true 100 | csharp_new_line_before_catch = true 101 | csharp_new_line_before_finally = true 102 | csharp_new_line_before_members_in_object_initializers = true 103 | csharp_new_line_before_members_in_anonymous_types = true 104 | 105 | # IDE 106 | dotnet_diagnostic.IDE0058.severity = none 107 | dotnet_diagnostic.RS2008.severity = none # RS2008: Enable analyzer release tracking 108 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | @mkristensen on Twitter. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Looking to contribute something? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 17 | [features requests](#feature-requests) and 18 | [submitting pull requests](#pull-requests), but please respect the 19 | following restrictions: 20 | 21 | * Please **do not** use the issue tracker for personal support requests. Stack 22 | Overflow is a better place to get help. 23 | 24 | * Please **do not** derail or troll issues. Keep the discussion on topic and 25 | respect the opinions of others. 26 | 27 | * Please **do not** open issues or pull requests which *belongs to* third party 28 | components. 29 | 30 | 31 | ## Bug reports 32 | 33 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 34 | Good bug reports are extremely helpful, so thanks! 35 | 36 | Guidelines for bug reports: 37 | 38 | 1. **Use the GitHub issue search** — check if the issue has already been 39 | reported. 40 | 41 | 2. **Check if the issue has been fixed** — try to reproduce it using the 42 | latest `master` or development branch in the repository. 43 | 44 | 3. **Isolate the problem** — ideally create an 45 | [SSCCE](http://www.sscce.org/) and a live example. 46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.) 47 | or creating a sample GitHub repository is also helpful. 48 | 49 | 50 | A good bug report shouldn't leave others needing to chase you up for more 51 | information. Please try to be as detailed as possible in your report. What is 52 | your environment? What steps will reproduce the issue? What browser(s) and OS 53 | experience the problem? Do other browsers show the bug differently? What 54 | would you expect to be the outcome? All these details will help people to fix 55 | any potential bugs. 56 | 57 | Example: 58 | 59 | > Short and descriptive example bug report title 60 | > 61 | > A summary of the issue and the Visual Studio, browser, OS environments 62 | > in which it occurs. If suitable, include the steps required to reproduce the bug. 63 | > 64 | > 1. This is the first step 65 | > 2. This is the second step 66 | > 3. Further steps, etc. 67 | > 68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium. 69 | > 70 | > Any other information you want to share that is relevant to the issue being 71 | > reported. This might include the lines of code that you have identified as 72 | > causing the bug, and potential solutions (and your opinions on their 73 | > merits). 74 | 75 | 76 | ## Feature requests 77 | 78 | Feature requests are welcome. But take a moment to find out whether your idea 79 | fits with the scope and aims of the project. It's up to *you* to make a strong 80 | case to convince the project's developers of the merits of this feature. Please 81 | provide as much detail and context as possible. 82 | 83 | 84 | ## Pull requests 85 | 86 | Good pull requests, patches, improvements and new features are a fantastic 87 | help. They should remain focused in scope and avoid containing unrelated 88 | commits. 89 | 90 | **Please ask first** before embarking on any significant pull request (e.g. 91 | implementing features, refactoring code, porting to a different language), 92 | otherwise you risk spending a lot of time working on something that the 93 | project's developers might not want to merge into the project. 94 | 95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the 96 | project (indentation, accurate comments, etc.) and any other requirements 97 | (such as test coverage). 98 | 99 | Adhering to the following process is the best way to get your work 100 | included in the project: 101 | 102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 103 | and configure the remotes: 104 | 105 | ```bash 106 | # Clone your fork of the repo into the current directory 107 | git clone https://github.com//.git 108 | # Navigate to the newly cloned directory 109 | cd 110 | # Assign the original repo to a remote called "upstream" 111 | git remote add upstream https://github.com/madskristensen/.git 112 | ``` 113 | 114 | 2. If you cloned a while ago, get the latest changes from upstream: 115 | 116 | ```bash 117 | git checkout master 118 | git pull upstream master 119 | ``` 120 | 121 | 3. Create a new topic branch (off the main project development branch) to 122 | contain your feature, change, or fix: 123 | 124 | ```bash 125 | git checkout -b 126 | ``` 127 | 128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 130 | or your code is unlikely be merged into the main project. Use Git's 131 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 132 | feature to tidy up your commits before making them public. Also, prepend name of the feature 133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`" 134 | 135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 6. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description against the `master` branch. 149 | 150 | 151 | ## Code guidelines 152 | 153 | - Always use proper indentation. 154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure 155 | `Place 'System' directives first when sorting usings` option is enabled (checked). 156 | - Before committing, organize usings for each updated C# source file. Either you can 157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension 158 | like [BatchFormat](https://marketplace.visualstudio.com/items?itemName=vs-publisher-147549.BatchFormat). 159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines 160 | to fix CA issues. Code Analysis commits can be made separately. 161 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: madskristensen 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/Windows.runsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | %GITHUB_WORKSPACE% 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json 2 | name: "Build" 3 | 4 | on: 5 | push: 6 | branches: [master] 7 | pull_request: 8 | branches: [master] 9 | workflow_dispatch: 10 | branches: [master] 11 | 12 | jobs: 13 | build: 14 | outputs: 15 | version: ${{ steps.vsix_version.outputs.version-number }} 16 | name: Build 17 | runs-on: windows-2022 18 | env: 19 | Configuration: Release 20 | DeployExtension: False 21 | VsixManifestPath: src\source.extension.vsixmanifest 22 | VsixManifestSourcePath: src\source.extension.cs 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | 27 | - name: Setup .NET build dependencies 28 | uses: timheuer/bootstrap-dotnet@v1 29 | with: 30 | nuget: 'false' 31 | sdk: 'false' 32 | msbuild: 'true' 33 | 34 | - name: Increment VSIX version 35 | id: vsix_version 36 | uses: timheuer/vsix-version-stamp@v1 37 | with: 38 | manifest-file: ${{ env.VsixManifestPath }} 39 | vsix-token-source-file: ${{ env.VsixManifestSourcePath }} 40 | 41 | - name: Build 42 | run: msbuild /v:m -restore /p:OutDir=\_built 43 | 44 | - name: Upload artifact 45 | uses: actions/upload-artifact@v2 46 | with: 47 | name: ${{ github.event.repository.name }}.vsix 48 | path: /_built/**/*.vsix 49 | 50 | publish: 51 | if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} 52 | needs: build 53 | runs-on: windows-latest 54 | 55 | steps: 56 | - uses: actions/checkout@v2 57 | 58 | - name: Download Package artifact 59 | uses: actions/download-artifact@v2 60 | with: 61 | name: ${{ github.event.repository.name }}.vsix 62 | 63 | - name: Upload to Open VSIX 64 | uses: timheuer/openvsixpublish@v1 65 | with: 66 | vsix-file: ${{ github.event.repository.name }}.vsix 67 | 68 | - name: Tag and Release 69 | if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[release]') }} 70 | id: tag_release 71 | uses: softprops/action-gh-release@v0.1.13 72 | with: 73 | body: Release ${{ needs.build.outputs.version }} 74 | tag_name: ${{ needs.build.outputs.version }} 75 | files: | 76 | **/*.vsix 77 | 78 | - name: Publish extension to Marketplace 79 | if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[release]') }} 80 | uses: cezarypiatek/VsixPublisherAction@0.1 81 | with: 82 | extension-file: '${{ github.event.repository.name }}.vsix' 83 | publish-manifest-file: 'vs-publish.json' 84 | personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Mads Kristensen 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [marketplace]: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.SolutionColors 2 | [vsixgallery]: http://vsixgallery.com/extension/SolutionColors.dfa813d0-736b-491d-921a-4a3503d41543/ 3 | [repo]: https://github.com/madskristensen/SolutionColors 4 | 5 | # Solution Colors for Visual Studio 6 | 7 | Allows you to associate a color with a solution or folder and display it in various locations within Visual Studio. Inspired by the [Peacock extension](https://marketplace.visualstudio.com/items?itemName=johnpapa.vscode-peacock) for VS Code and [this Visual Studio feature request](https://developercommunity.visualstudio.com/t/Per-SolutionFolder-Color-Theme/608136?space=8&ftype=idea). 8 | 9 | [![Build](https://github.com/madskristensen/SolutionColors/actions/workflows/build.yaml/badge.svg)](https://github.com/madskristensen/SolutionColors/actions/workflows/build.yaml) 10 | 11 | Download this extension from the [Visual Studio Marketplace][marketplace] 12 | or get the [CI build][vsixgallery]. 13 | 14 | --- 15 | 16 | When you have multiple instances of Visual Studio open at the same time, it can be tricky to tell them apart. Especially if you’re working on different branches of the same solution, which makes them look almost identical. This extension solves this issue by colorizing each instance to make it easy to tell them apart. 17 | 18 | ![Top of VS](art/colors.png) 19 | 20 | The result is a subtle, yet very visible colorization that doesn’t feel noisy or distracting. It puts you in control with an array of customization options. 21 | 22 | ## Getting Started 23 | To enable colorization, open a solution or folder in Visual Studio. 24 | In the Solution Explorer window > Right click the top level solution > Set Solution Color > (Select Color) 25 | From here you can choose between a list of predefined colors matching the color palette used for colorizing document tabs. 26 | 27 | ![Solution Context Menu](art/solution-context-menu.png) 28 | 29 | You are not limited to only choosing between the predefined colors. By selecting **Custom...** you can choose any custom color from the color dialog. 30 | 31 | ![custom colors](art/custom-colors.png) 32 | 33 | Visual Studio stores the color in the *.vs* folder next to the solution file or in the root of the workspace folder. That ensures that the same solution will always receive the same color. 34 | 35 | After selecting a color manually, the **Automatic** button changes to **None**. That allows you to remove the color if you no longer want it. 36 | 37 | ![Context Menu None](art/context-menu-none.png) 38 | 39 | ## Automatic 40 | 41 | Instead of manually assigning a color to every solution, Visual Studio can do it automatically. With this option enabled, all solutions will be assigned a color when opened. The color is calculated based on the hash of the full path of the solution, so each solution will always be assigned the same color. 42 | 43 | When Automatic colorization is enabled, the button in the submenu shows a checkmark. 44 | 45 | ![Context Menu Disable](art/context-menu-disable.png) 46 | 47 | When automatic colorization is enabled, you can still choose your own custom color for your solution. A manually selected color always takes precedence over automatic. 48 | 49 | ## Colorized elements 50 | - The solution name in the title bar is visible at all times and located at the top, which makes it a prime location for colorization. 51 | 52 | ![Solution Label](art/solution-label.png) 53 | 54 | - In addition, the 3 top-most pixels of Visual Studio span the full width of the window. This is especially visible when Visual Studio instances are floating or if you’ve chosen not to display the solution name label. 55 | 56 | ![Top](art/top.png) 57 | 58 | - The Windows Taskbar shows the colors in the thumbnails as well. 59 | 60 | ![Taskbar](art/taskbar.png) 61 | 62 | - And if you don’t group the Taskbar items, each item will show the color as well. 63 | 64 | ![Taskbar Icons](art/taskbar-icons.png) 65 | 66 | This gives you 4 different locations to display the color and you can use all of them, or just the ones you find most helpful. You can control all that from the **Tools -> Options** page. 67 | 68 | ![Options](art/options.png) 69 | 70 | To customize the colored borders, open the Border settings dialog and chose which borders and what thickness to display. 71 | 72 | ![Border settings](art/border-settings.png) 73 | 74 | ## How can I help? 75 | 76 | If you enjoy using the extension, please give it a ★★★★★ rating on the [Visual Studio Marketplace][marketplace]. 77 | 78 | Should you encounter bugs or if you have feature requests, head on over to the [GitHub repo][repo] to open an issue if one doesn't already exist. 79 | 80 | Pull requests are also very welcome, since I can't always get around to fixing all bugs myself. This is a personal passion project, so my time is limited. 81 | 82 | Another way to help out is to [sponsor me on GitHub](https://github.com/sponsors/madskristensen). 83 | -------------------------------------------------------------------------------- /SolutionColors.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.32720.392 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionColors", "src\SolutionColors.csproj", "{1661127A-05A1-4935-B885-6D7CE4D1E57E}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{85869CDC-0A86-41BC-8AD8-B08674BE4395}" 9 | ProjectSection(SolutionItems) = preProject 10 | .editorconfig = .editorconfig 11 | README.md = README.md 12 | vs-publish.json = vs-publish.json 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Debug|arm64 = Debug|arm64 19 | Debug|x86 = Debug|x86 20 | Release|Any CPU = Release|Any CPU 21 | Release|arm64 = Release|arm64 22 | Release|x86 = Release|x86 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Debug|arm64.ActiveCfg = Debug|arm64 28 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Debug|arm64.Build.0 = Debug|arm64 29 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Debug|x86.ActiveCfg = Debug|x86 30 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Debug|x86.Build.0 = Debug|x86 31 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Release|arm64.ActiveCfg = Release|arm64 34 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Release|arm64.Build.0 = Release|arm64 35 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Release|x86.ActiveCfg = Release|x86 36 | {1661127A-05A1-4935-B885-6D7CE4D1E57E}.Release|x86.Build.0 = Release|x86 37 | EndGlobalSection 38 | GlobalSection(SolutionProperties) = preSolution 39 | HideSolutionNode = FALSE 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | SolutionGuid = {F36C85BF-F039-4B81-A161-0978090F981D} 43 | EndGlobalSection 44 | EndGlobal 45 | -------------------------------------------------------------------------------- /art/border-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/border-settings.png -------------------------------------------------------------------------------- /art/colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/colors.png -------------------------------------------------------------------------------- /art/context-menu-disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/context-menu-disable.png -------------------------------------------------------------------------------- /art/context-menu-none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/context-menu-none.png -------------------------------------------------------------------------------- /art/context-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/context-menu.png -------------------------------------------------------------------------------- /art/custom-colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/custom-colors.png -------------------------------------------------------------------------------- /art/options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/options.png -------------------------------------------------------------------------------- /art/solution-context-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/solution-context-menu.png -------------------------------------------------------------------------------- /art/solution-label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/solution-label.png -------------------------------------------------------------------------------- /art/taskbar-icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/taskbar-icons.png -------------------------------------------------------------------------------- /art/taskbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/taskbar.png -------------------------------------------------------------------------------- /art/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/art/top.png -------------------------------------------------------------------------------- /nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/ColorCache.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Windows.Media; 4 | 5 | namespace SolutionColors 6 | { 7 | public static class ColorCache 8 | { 9 | private static readonly Dictionary _colorTranslator = new() 10 | { 11 | { "Burgundy", "Tomato" }, 12 | { "Pumpkin", "OrangeRed" }, 13 | { "Volt", "YellowGreen" }, 14 | { "Mint", "MediumAquamarine" }, 15 | { "DarkBrown", "SaddleBrown" }, 16 | { "Lavender", "MediumPurple" }, 17 | }; 18 | 19 | private static Dictionary ColorMap { get; } = new(); 20 | 21 | public static int GetIndex(string name) 22 | { 23 | return ColorMap.Keys.ToList().IndexOf(name); 24 | } 25 | 26 | public static string GetColorCode(string name) 27 | { 28 | if (ColorMap.ContainsKey(name)) 29 | { 30 | return ColorMap[name]; 31 | } 32 | 33 | object fromHex = ColorConverter.ConvertFromString(name); 34 | 35 | if (fromHex is Color) 36 | { 37 | return name; 38 | } 39 | 40 | return null; 41 | } 42 | 43 | public static void AddColor(string name) 44 | { 45 | if (_colorTranslator.TryGetValue(name, out string code)) 46 | { 47 | ColorMap.Add(name, code); 48 | } 49 | else 50 | { 51 | ColorMap.Add(name, name); 52 | } 53 | } 54 | 55 | public static string GetColor(string filePath) 56 | { 57 | int hash = Math.Abs(filePath.GetHashCode()); 58 | int mod = hash % (ColorMap.Count - 1); //last one is "None" which is not a valid color 59 | 60 | return ColorMap[ColorMap.Keys.ElementAt(mod)]; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/ColorHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Media; 9 | using System.Windows.Shell; 10 | using EnvDTE80; 11 | using Microsoft.VisualStudio.PlatformUI; 12 | using Microsoft.VisualStudio.Shell.Interop; 13 | using Microsoft.VisualStudio.Telemetry; 14 | 15 | namespace SolutionColors 16 | { 17 | public class ColorHelper 18 | { 19 | public const string ColorFileName = "color.txt"; 20 | 21 | private static Border _solutionLabel; 22 | private static Brush _originalLabelColor; 23 | private static SolidColorBrush _originalLabelForeground; 24 | private static PropertyInfo _solutionLabelForegroundProperty; 25 | 26 | //INFO: 27 | //colorMaster: the color of master branch 28 | //colorBranch: the color of branch (= master branch color when unitary coloration) 29 | 30 | public static async Task ResetInstanceAsync() 31 | { 32 | _colorEntries = null; 33 | await RemoveUIAsync(); 34 | } 35 | 36 | public static async Task SetColorAsync(string colorName) 37 | { 38 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 39 | 40 | General options = await General.GetLiveInstanceAsync(); 41 | 42 | if (_colorEntries == null) 43 | { 44 | await LoadColorsAsync(await GitHelper.GetBranchNameAsync()); 45 | } 46 | 47 | string fileName = await GetFileNameAsync(); 48 | string _branch = string.Empty; 49 | 50 | if (options.Coloration == Coloration.Unitary) //use only master color 51 | { 52 | _branch = "master"; 53 | } 54 | else 55 | { 56 | _branch = await GitHelper.GetBranchNameAsync(); 57 | } 58 | 59 | ColorEntry colorEntry = _colorEntries.FirstOrDefault(x => x.branch == _branch); 60 | if (colorEntry != null) 61 | { 62 | colorEntry.color = colorName; 63 | } 64 | else 65 | { 66 | _colorEntries.Add(new() { branch = _branch, color = colorName }); 67 | } 68 | 69 | string fileContent = string.Empty; 70 | foreach (ColorEntry colorEntryToSave in _colorEntries) 71 | { 72 | fileContent += (fileContent.Length == 0 ? "" : Environment.NewLine) + colorEntryToSave.branch + ":" + colorEntryToSave.color; 73 | } 74 | File.WriteAllText(await GetFileNameAsync(), fileContent); 75 | } 76 | 77 | public static async Task SolutionHasCustomColorAsync() 78 | { 79 | return File.Exists(await GetFileNameAsync()); 80 | } 81 | 82 | public static async Task GetColorAsync(string branch) 83 | { 84 | if (_colorEntries == null) 85 | { 86 | await LoadColorsAsync(branch); 87 | } 88 | 89 | ColorEntry colorEntry = _colorEntries.FirstOrDefault(x => x.branch == branch); 90 | if (colorEntry != null) 91 | { 92 | return colorEntry.color; 93 | } 94 | else 95 | { 96 | if (branch == "master") 97 | { 98 | return string.Empty; 99 | } 100 | else 101 | { 102 | return Colors.DarkGray.ToString(); 103 | } 104 | } 105 | } 106 | 107 | public static async Task ColorizeAsync() 108 | { 109 | await SetUiColorAsync(); 110 | } 111 | 112 | public static async Task LoadColorsAsync(string branch) 113 | { 114 | _colorEntries ??= new(); 115 | 116 | string fileName = await GetFileNameAsync(); 117 | 118 | if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName)) 119 | { 120 | //Compatibility to older version 121 | string fileContent = File.ReadAllText(fileName); 122 | string[] lines = fileContent.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); 123 | if (lines.Count() == 1 && lines[0].Split(':').Count() == 1) 124 | { 125 | _colorEntries.Add(new ColorEntry() { branch = "master", color = lines[0] }); 126 | } 127 | else 128 | { 129 | foreach (string line in lines) 130 | { 131 | string[] lineSegments = line.Split(':'); 132 | _colorEntries.Add(new() { branch = lineSegments[0], color = lineSegments[1] }); 133 | } 134 | } 135 | } 136 | } 137 | 138 | static private async void WindowEvents_WindowActivated(EnvDTE.Window GotFocus, EnvDTE.Window LostFocus) 139 | { 140 | WindowCollection allWindows = Application.Current.Windows; 141 | int count = allWindows.Count; 142 | await SetUiColorAsync(); 143 | } 144 | 145 | public static async Task RemoveUIAsync() 146 | { 147 | DTE2 env = (EnvDTE80.DTE2)await ServiceProvider.GetGlobalServiceAsync(typeof(SDTE)); 148 | if (env != null) 149 | { 150 | env.Events.WindowEvents.WindowActivated -= WindowEvents_WindowActivated; 151 | } 152 | 153 | if (VsShellUtilities.ShellIsShuttingDown) 154 | { 155 | return; 156 | } 157 | 158 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 159 | 160 | foreach (Enum value in Enum.GetValues(typeof(BorderLocation))) 161 | { 162 | string controlName = GetControlName((BorderLocation)value); 163 | Border _border = Application.Current.MainWindow.FindChild(controlName); 164 | if (_border != null) 165 | { 166 | _border.BorderThickness = new Thickness(0); 167 | } 168 | } 169 | 170 | if (_solutionLabel != null) 171 | { 172 | _solutionLabel.Background = _originalLabelColor; 173 | _solutionLabelForegroundProperty.SetValue(_solutionLabel.Child, _originalLabelForeground); 174 | } 175 | 176 | ResetTaskbar(); 177 | } 178 | 179 | public static async Task ClearSolutionAsync() 180 | { 181 | string fileName = await GetFileNameAsync(); 182 | 183 | if (File.Exists(fileName)) 184 | { 185 | File.Delete(fileName); 186 | } 187 | } 188 | 189 | public static async Task ResetAsync() 190 | { 191 | await RemoveUIAsync(); 192 | await SetUiColorAsync(); 193 | 194 | General options = await General.GetLiveInstanceAsync(); 195 | if (options.ShowTaskBarThumbnails != Options.TaskBarOptions.None || options.ShowTaskBarOverlay) 196 | { 197 | DTE2 env = (EnvDTE80.DTE2)await ServiceProvider.GetGlobalServiceAsync(typeof(SDTE)); 198 | if (env != null) 199 | { 200 | env.Events.WindowEvents.WindowActivated += WindowEvents_WindowActivated; 201 | } 202 | } 203 | } 204 | 205 | public static async Task GetFileNameAsync() 206 | { 207 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 208 | 209 | Solution solution = await VS.Solutions.GetCurrentSolutionAsync(); 210 | 211 | if (solution?.FullPath == null) 212 | { 213 | return null; 214 | } 215 | 216 | string rootDir; 217 | 218 | if (solution?.Name?.EndsWith(".wsp") == true) 219 | { 220 | // .wsp is Open Folder and not regular .sln solutions 221 | rootDir = solution.FullPath; 222 | } 223 | else 224 | { 225 | rootDir = Path.GetDirectoryName(solution.FullPath); 226 | } 227 | 228 | General options = await General.GetLiveInstanceAsync(); 229 | 230 | string vsDir; 231 | 232 | if (options.SaveInRoot) 233 | { 234 | vsDir = rootDir; 235 | } 236 | else 237 | { 238 | vsDir = Path.Combine( 239 | rootDir, 240 | ".vs", 241 | Path.GetFileNameWithoutExtension(await solution.GetSolutionNameAsync())); 242 | 243 | if (!Directory.Exists(vsDir)) 244 | { 245 | DirectoryInfo di = Directory.CreateDirectory(vsDir); 246 | di.Attributes = FileAttributes.Directory | FileAttributes.Hidden; 247 | } 248 | } 249 | 250 | return Path.Combine(vsDir, ColorFileName); 251 | } 252 | 253 | private static async Task SetUiColorAsync() 254 | { 255 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 256 | 257 | string currentBranch = await GitHelper.GetBranchNameAsync(); 258 | 259 | General options = await General.GetLiveInstanceAsync(); 260 | 261 | if (string.IsNullOrEmpty(await GetColorAsync("master")) && options.AutoMode == false) 262 | { 263 | await RemoveUIAsync(); 264 | return; 265 | } 266 | 267 | Color colorMaster; 268 | if (options.AutoMode == true && !await SolutionHasCustomColorAsync()) 269 | { 270 | Solution sol = await VS.Solutions.GetCurrentSolutionAsync(); 271 | if (sol?.FullPath != null) 272 | { 273 | string path = await sol.GetSolutionPathAsync(); 274 | colorMaster = (Color)ColorConverter.ConvertFromString(ColorCache.GetColor(path)); 275 | } 276 | else 277 | { 278 | colorMaster = Colors.Black; 279 | } 280 | } 281 | else 282 | { 283 | colorMaster = (Color)ColorConverter.ConvertFromString(ColorCache.GetColorCode(await GetColorAsync("master"))); 284 | } 285 | 286 | Color colorBranch; 287 | if (currentBranch == "master") 288 | { 289 | colorBranch = colorMaster; 290 | } 291 | else 292 | { 293 | if (options.AutoMode == true && !await SolutionHasCustomColorAsync()) 294 | { 295 | Solution sol = await VS.Solutions.GetCurrentSolutionAsync(); 296 | if (sol?.FullPath != null) 297 | { 298 | string path = await sol.GetSolutionPathAsync(); 299 | colorBranch = (Color)ColorConverter.ConvertFromString(ColorCache.GetColor(path + currentBranch)); 300 | } 301 | else 302 | { 303 | colorBranch = Colors.Black; 304 | } 305 | } 306 | else 307 | { 308 | string colorNameBranch = await GetColorAsync(currentBranch); 309 | if (string.IsNullOrEmpty(colorNameBranch)) 310 | { 311 | if (options.Coloration == Coloration.Branch) 312 | { 313 | await RemoveUIAsync(); 314 | return; 315 | } 316 | else 317 | { 318 | colorBranch = Colors.Black; 319 | } 320 | } 321 | else 322 | { 323 | colorBranch = (Color)ColorConverter.ConvertFromString(ColorCache.GetColorCode(await GetColorAsync(currentBranch))); 324 | } 325 | } 326 | } 327 | 328 | 329 | 330 | ShowInBorders(colorMaster, colorBranch, options); 331 | 332 | if (options.ShowTitleBar) 333 | { 334 | ShowInTitleBar(colorMaster, colorBranch, options); 335 | } 336 | 337 | if (options.ShowTaskBarThumbnails != Options.TaskBarOptions.None || options.ShowTaskBarOverlay) 338 | { 339 | ShowInTaskBar(colorMaster, colorBranch, options); 340 | } 341 | 342 | TelemetryEvent tel = Telemetry.CreateEvent("ColorApplied"); 343 | tel.Properties[nameof(options.ShowTaskBarOverlay)] = options.ShowTaskBarOverlay; 344 | tel.Properties[nameof(options.ShowTaskBarThumbnails)] = options.ShowTaskBarThumbnails; 345 | tel.Properties[nameof(options.ShowTitleBar)] = options.ShowTitleBar; 346 | tel.Properties[nameof(options.AutoMode)] = options.AutoMode; 347 | tel.Properties[nameof(options.SaveInRoot)] = options.SaveInRoot; 348 | tel.Properties[nameof(options.Borders)] = options.Borders; 349 | tel.Properties[nameof(options.Coloration)] = options.Coloration; 350 | tel.Properties[nameof(options.BaseColor)] = options.BaseColor; 351 | tel.Properties[nameof(options.UseGradientTaskbar)] = options.UseGradientTaskbar; 352 | tel.Properties[nameof(options.UseGradientTitlebar)] = options.UseGradientTitlebar; 353 | tel.Properties[nameof(options.GradientBorders)] = options.GradientBorders; 354 | Telemetry.TrackEvent(tel); 355 | } 356 | 357 | private static void ShowInTaskBar(Color colorMaster, Color colorBranch, General options) 358 | { 359 | ResetTaskbar(); 360 | 361 | //LinearGradientBrush brush = new LinearGradientBrush(colorMaster, colorBranch, 0); 362 | Brush brush = GetBrushForTaskbar(colorMaster, colorBranch, options); 363 | 364 | switch(options.ShowTaskBarThumbnails) 365 | { 366 | case Options.TaskBarOptions.MainWindowOnly: 367 | Application.Current.MainWindow.TaskbarItemInfo.ThumbButtonInfos.Add(new ThumbButtonInfo() { ImageSource = brush.GetImageSource(16, options), IsBackgroundVisible = false, IsInteractive = false }); 368 | break; 369 | case Options.TaskBarOptions.AllWindows: 370 | foreach (System.Windows.Window window in Application.Current.Windows) 371 | { 372 | if (window.TaskbarItemInfo == null) 373 | window.TaskbarItemInfo = new TaskbarItemInfo(); 374 | 375 | if (window.TaskbarItemInfo.ThumbButtonInfos == null) 376 | window.TaskbarItemInfo.ThumbButtonInfos = new ThumbButtonInfoCollection(); 377 | 378 | window.TaskbarItemInfo.ThumbButtonInfos.Add(new ThumbButtonInfo() { ImageSource = brush.GetImageSource(16, options), IsBackgroundVisible = false, IsInteractive = false }); 379 | } 380 | break; 381 | default: 382 | break; 383 | } 384 | 385 | if (options.ShowTaskBarOverlay) 386 | { 387 | foreach (System.Windows.Window window in Application.Current.Windows) 388 | { 389 | window.TaskbarItemInfo.Overlay = brush.GetImageSource(12, options); 390 | } 391 | } 392 | } 393 | 394 | private static Brush GetBrushForTaskbar(Color colorMaster, Color colorBranch, General options) 395 | { 396 | Brush brush = null; 397 | if (options.Coloration == Coloration.Unitary) 398 | { 399 | brush = new SolidColorBrush(colorMaster); 400 | } 401 | else if (options.Coloration == Coloration.Branch) 402 | { 403 | brush = new SolidColorBrush(colorBranch); 404 | } 405 | else if (options.Coloration == Coloration.Combined) 406 | { 407 | if (options.UseGradientTaskbar == false) 408 | { 409 | if (options.BaseColor == BaseColor.MasterColor) 410 | { 411 | brush = new SolidColorBrush(colorMaster); 412 | } 413 | else 414 | { 415 | brush = new SolidColorBrush(colorBranch); 416 | } 417 | } 418 | else 419 | { 420 | brush = new LinearGradientBrush(colorMaster, colorBranch, new Point(0.3, 0), new Point(0.7, 0)); 421 | } 422 | } 423 | return brush; 424 | } 425 | 426 | private static void ShowInBorders(Color colorMaster, Color colorBranch, General options) 427 | { 428 | foreach (Enum value in Enum.GetValues(options.Borders.BorderDetails.Locations.GetType())) 429 | { 430 | 431 | if (options.Borders.BorderDetails.Locations.HasFlag(value)) 432 | { 433 | string controlName = GetControlName((BorderLocation)value); 434 | Border _border = Application.Current.MainWindow.FindChild(controlName); 435 | 436 | if (_border != null) 437 | { 438 | _border.BorderBrush = GetBrushForBorder(colorMaster, colorBranch, options, (BorderLocation)value); 439 | 440 | switch ((BorderLocation)value) 441 | { 442 | case BorderLocation.Bottom: 443 | _border.BorderThickness = new Thickness(0, General.Instance.Borders.BorderDetails.WidthBottom, 0, 0); 444 | break; 445 | case BorderLocation.Left: 446 | _border.BorderThickness = new Thickness(General.Instance.Borders.BorderDetails.WidthLeft, 0, 0, 0); 447 | break; 448 | case BorderLocation.Right: 449 | _border.BorderThickness = new Thickness(General.Instance.Borders.BorderDetails.WidthRight, 0, 0, 0); 450 | break; 451 | case BorderLocation.Top: 452 | _border.BorderThickness = new Thickness(0, General.Instance.Borders.BorderDetails.WidthTop, 0, 0); 453 | break; 454 | } 455 | } 456 | } 457 | } 458 | } 459 | 460 | private static Brush GetBrushForBorder(Color colorMaster, Color colorBranch, General options, BorderLocation borderLocation) 461 | { 462 | Brush brush = null; 463 | if (options.Coloration == Coloration.Unitary) 464 | { 465 | brush = new SolidColorBrush(colorMaster); 466 | } 467 | else if (options.Coloration == Coloration.Branch) 468 | { 469 | brush = new SolidColorBrush(colorBranch); 470 | } 471 | else if (options.Coloration == Coloration.Combined) 472 | { 473 | if (options.GradientBorders == Gradient.RadialGradient) 474 | { 475 | //brush = new RadialGradientBrush(colorBranch, colorMaster); 476 | GradientStopCollection gradientStopCollection = new() 477 | { 478 | new GradientStop() { Color = colorBranch, Offset = 0 }, 479 | new GradientStop() { Color = colorBranch, Offset = 0.75 }, 480 | new GradientStop() { Color = colorMaster, Offset = 1 } 481 | }; 482 | brush = new RadialGradientBrush(gradientStopCollection); 483 | } 484 | else if (options.GradientBorders == Gradient.LinearGradient) 485 | { 486 | if (borderLocation == BorderLocation.Bottom) 487 | { 488 | brush = new LinearGradientBrush(colorBranch, colorMaster, new Point(0.3, 0), new Point(0.7, 0)); 489 | } 490 | if (borderLocation == BorderLocation.Left) 491 | { 492 | brush = new LinearGradientBrush(colorMaster, colorBranch, new Point(0, 0.3), new Point(0, 0.7)); 493 | } 494 | if (borderLocation == BorderLocation.Right) 495 | { 496 | brush = new LinearGradientBrush(colorBranch, colorMaster, new Point(0, 0.3), new Point(0, 0.7)); 497 | } 498 | if (borderLocation == BorderLocation.Top) 499 | { 500 | brush = new LinearGradientBrush(colorMaster, colorBranch, new Point(0.3, 0), new Point(0.7, 0)); 501 | } 502 | } 503 | } 504 | return brush; 505 | } 506 | 507 | private static void ShowInTitleBar(Color colorMaster, Color colorBranch, General options) 508 | { 509 | Brush brush = GetBrushForTitlebar(colorMaster, colorBranch, options); 510 | 511 | if (_solutionLabel == null) 512 | { 513 | _solutionLabel = Application.Current.MainWindow.FindChild("PART_SolutionNameTextBlock").Parent as Border; 514 | _originalLabelColor = _solutionLabel?.Background; 515 | } 516 | 517 | if (_solutionLabel != null) 518 | { 519 | _solutionLabelForegroundProperty ??= _solutionLabel.Child.GetType().GetProperty("Foreground", BindingFlags.Public | BindingFlags.Instance); 520 | _originalLabelForeground ??= _solutionLabelForegroundProperty?.GetValue(_solutionLabel.Child) as SolidColorBrush; 521 | 522 | if (_solutionLabelForegroundProperty != null) 523 | { 524 | _solutionLabel.Background = brush; 525 | ContrastComparisonResult contrast = ContrastComparisonResult.ContrastHigherWithBlack; 526 | if (options.Coloration == Coloration.Unitary || options.Coloration == Coloration.Combined) 527 | { 528 | contrast = ColorUtilities.CompareContrastWithBlackAndWhite(colorMaster); 529 | } 530 | else if (options.Coloration == Coloration.Branch) 531 | { 532 | contrast = ColorUtilities.CompareContrastWithBlackAndWhite(colorBranch); 533 | } 534 | _solutionLabelForegroundProperty.SetValue(_solutionLabel.Child, contrast == ContrastComparisonResult.ContrastHigherWithWhite ? Brushes.White : Brushes.Black); 535 | } 536 | } 537 | } 538 | 539 | private static Brush GetBrushForTitlebar(Color colorMaster, Color colorBranch, General options) 540 | { 541 | Brush brush = null; 542 | if (options.Coloration == Coloration.Unitary) 543 | { 544 | brush = new SolidColorBrush(colorMaster); 545 | } 546 | else if (options.Coloration == Coloration.Branch) 547 | { 548 | brush = new SolidColorBrush(colorBranch); 549 | } 550 | else if (options.Coloration == Coloration.Combined) 551 | { 552 | if (options.UseGradientTitlebar == false) 553 | { 554 | if (options.BaseColor == BaseColor.MasterColor) 555 | { 556 | brush = new SolidColorBrush(colorMaster); 557 | } 558 | else 559 | { 560 | brush = new SolidColorBrush(colorBranch); 561 | } 562 | } 563 | else 564 | { 565 | brush = new LinearGradientBrush(colorMaster, colorBranch, new Point(0.8, 0), new Point(0.9, 0)); 566 | } 567 | } 568 | return brush; 569 | } 570 | 571 | private static void ResetTaskbar() 572 | { 573 | foreach (Window window in Application.Current.Windows) 574 | { 575 | window.TaskbarItemInfo ??= new(); 576 | window.TaskbarItemInfo.ThumbButtonInfos ??= new ThumbButtonInfoCollection(); 577 | window.TaskbarItemInfo.ThumbButtonInfos.Clear(); 578 | window.TaskbarItemInfo.Overlay = null; 579 | } 580 | } 581 | 582 | private static string GetControlName(BorderLocation location) => location switch 583 | { 584 | BorderLocation.Left => "LeftDockBorder", 585 | BorderLocation.Right => "RightDockBorder", 586 | BorderLocation.Top => "MainWindowTitleBar", 587 | _ => "BottomDockBorder", 588 | }; 589 | 590 | 591 | 592 | private static List _colorEntries = null; 593 | 594 | public class ColorEntry 595 | { 596 | public string branch { get; set; } 597 | public string color { get; set; } 598 | } 599 | } 600 | } 601 | -------------------------------------------------------------------------------- /src/Commands/CustomCommand.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Windows.Forms; 3 | using System.Windows.Media; 4 | 5 | namespace SolutionColors 6 | { 7 | [Command(PackageIds.Custom)] 8 | internal class CustomCommand : BaseCommand 9 | { 10 | protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) 11 | { 12 | ColorDialog dialog = new(); 13 | DialogResult result = dialog.ShowDialog(); 14 | 15 | if (result == DialogResult.OK) 16 | { 17 | Color converted = Color.FromArgb(dialog.Color.A, dialog.Color.R, dialog.Color.G, dialog.Color.B); 18 | 19 | await ColorHelper.SetColorAsync(converted.ToString()); 20 | await ColorHelper.ColorizeAsync(); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Commands/OptionsCommand.cs: -------------------------------------------------------------------------------- 1 | namespace SolutionColors 2 | { 3 | [Command(PackageIds.Options)] 4 | internal class OptionsCommand : BaseCommand 5 | { 6 | protected override void Execute(object sender, EventArgs e) 7 | { 8 | Package.ShowOptionPage(typeof(OptionsProvider.GeneralOptions)); 9 | Telemetry.TrackUserTask("OpenSettings"); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Commands/SetColorCommandFolder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition; 3 | using Microsoft.VisualStudio.OLE.Interop; 4 | using Microsoft.VisualStudio.Workspace.VSIntegration.UI; 5 | 6 | namespace SolutionColors 7 | { 8 | [Export(typeof(INodeExtender))] 9 | public class SetColorCommandFolderProvider : INodeExtender 10 | { 11 | private readonly IWorkspaceCommandHandler _handler = new SetColorCommandFolder(); 12 | 13 | public IChildrenSource ProvideChildren(WorkspaceVisualNodeBase parentNode) => null; 14 | 15 | public IWorkspaceCommandHandler ProvideCommandHandler(WorkspaceVisualNodeBase parentNode) 16 | { 17 | if (parentNode is IFolderNode) 18 | { 19 | return _handler; 20 | } 21 | 22 | return null; 23 | } 24 | } 25 | 26 | public class SetColorCommandFolder : IWorkspaceCommandHandler 27 | { 28 | public static bool IsRoot { get; private set; } 29 | 30 | public bool IgnoreOnMultiselect => true; 31 | 32 | public int Priority => 100; 33 | 34 | public int Exec(List selection, Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) 35 | { 36 | return (int)Constants.OLECMDERR_E_NOTSUPPORTED; 37 | } 38 | 39 | public bool QueryStatus(List selection, Guid pguidCmdGroup, uint nCmdID, ref uint cmdf, ref string customTitle) 40 | { 41 | if (pguidCmdGroup == PackageGuids.SolutionColors) 42 | { 43 | IsRoot = selection[0] == selection[0].Root; 44 | } 45 | 46 | return false; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Commands/SetColorCommandSolution.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Microsoft.VisualStudio.Telemetry; 3 | 4 | namespace SolutionColors 5 | { 6 | [Command(PackageIds.Lavender)] internal sealed class Lavender : ColorBaseCommand { } 7 | [Command(PackageIds.Gold)] internal sealed class Gold : ColorBaseCommand { } 8 | [Command(PackageIds.Cyan)] internal sealed class Cyan : ColorBaseCommand { } 9 | [Command(PackageIds.Burgundy)] internal sealed class Burgundy : ColorBaseCommand { } 10 | [Command(PackageIds.Green)] internal sealed class Green : ColorBaseCommand { } 11 | [Command(PackageIds.Brown)] internal sealed class Brown : ColorBaseCommand { } 12 | [Command(PackageIds.RoyalBlue)] internal sealed class RoyalBlue : ColorBaseCommand { } 13 | [Command(PackageIds.Pumpkin)] internal sealed class Pumpkin : ColorBaseCommand { } 14 | [Command(PackageIds.Gray)] internal sealed class Gray : ColorBaseCommand { } 15 | [Command(PackageIds.Volt)] internal sealed class Volt : ColorBaseCommand { } 16 | [Command(PackageIds.Teal)] internal sealed class Teal : ColorBaseCommand { } 17 | [Command(PackageIds.Magenta)] internal sealed class Magenta : ColorBaseCommand { } 18 | [Command(PackageIds.Mint)] internal sealed class Mint : ColorBaseCommand { } 19 | [Command(PackageIds.DarkBrown)] internal sealed class DarkBrown : ColorBaseCommand { } 20 | [Command(PackageIds.Blue)] internal sealed class Blue : ColorBaseCommand { } 21 | [Command(PackageIds.Pink)] internal sealed class Pink : ColorBaseCommand { } 22 | [Command(PackageIds.None)] internal sealed class None : ColorBaseCommand { } 23 | 24 | internal abstract class ColorBaseCommand : BaseCommand where T : class, new() 25 | { 26 | private readonly string _color; 27 | 28 | public ColorBaseCommand() 29 | { 30 | _color = GetType().Name; 31 | 32 | ColorCache.AddColor(_color); 33 | } 34 | 35 | protected override void BeforeQueryStatus(EventArgs e) 36 | { 37 | Solution solution = VS.Solutions.GetCurrentSolution(); 38 | 39 | if (solution?.Name?.EndsWith(".wsp") == true) 40 | { 41 | Command.Visible = Command.Enabled = SetColorCommandFolder.IsRoot; 42 | } 43 | 44 | #pragma warning disable VSTHRD102 // Implement internal logic asynchronously 45 | Package.JoinableTaskFactory.Run(async () => 46 | { 47 | if (await ColorHelper.SolutionHasCustomColorAsync()) 48 | { 49 | Command.Text = "None"; 50 | Command.Checked = false; 51 | } 52 | else 53 | { 54 | Command.Text = "Automatic"; 55 | Command.Checked = General.Instance.AutoMode; 56 | } 57 | }); 58 | #pragma warning restore VSTHRD102 // Implement internal logic asynchronously 59 | } 60 | 61 | protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) 62 | { 63 | if (_color == "None") 64 | { 65 | General options = await General.GetLiveInstanceAsync(); 66 | 67 | if (await ColorHelper.SolutionHasCustomColorAsync()) 68 | { 69 | if (options.AutoMode) 70 | { 71 | bool disableAutoMode = await VS.MessageBox.ShowConfirmAsync("Automatic colorization is currently enabled. Do you wish to disable it too?"); 72 | 73 | if (disableAutoMode) 74 | { 75 | options.AutoMode = false; 76 | await options.SaveAsync(); 77 | } 78 | 79 | await ColorHelper.SetColorAsync((string)null); 80 | await ColorHelper.ColorizeAsync(); 81 | } 82 | else 83 | { 84 | await ColorHelper.SetColorAsync((string)null); 85 | await ColorHelper.ColorizeAsync(); 86 | } 87 | } 88 | else 89 | { 90 | options.AutoMode = !options.AutoMode; 91 | await options.SaveAsync(); 92 | await ColorHelper.ResetAsync(); 93 | } 94 | } 95 | else 96 | { 97 | await ColorHelper.SetColorAsync(_color); 98 | await ColorHelper.ColorizeAsync(); 99 | } 100 | 101 | TelemetryEvent tel = Telemetry.CreateEvent("ChangedColor"); 102 | tel.Properties["Color"] = _color; 103 | Telemetry.TrackEvent(tel); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/ExtensionMethods/BrushExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | using System.Windows.Media.Imaging; 5 | 6 | namespace SolutionColors 7 | { 8 | public static class BrushExtensions 9 | { 10 | public static ImageSource GetImageSource(this Brush brush, int size, General options) 11 | { 12 | switch(options.TaskbarIconMode) 13 | { 14 | case IconMode.ColoredSquare: 15 | return brush.GetColoredSquareSource(size); 16 | case IconMode.CustomIcon: 17 | return brush.GetCustomLogoSource(options.CustomTaskBarIconPath.FilePath); 18 | default: 19 | return brush.GetEmptyImageSource(); 20 | } 21 | } 22 | 23 | private static ImageSource GetColoredSquareSource(this Brush brush, int size) 24 | { 25 | DrawingVisual dVisual = new(); 26 | using (DrawingContext dc = dVisual.RenderOpen()) 27 | { 28 | dc.DrawRectangle(brush, null, new Rect(0, 0, size, size)); 29 | } 30 | RenderTargetBitmap targetBitmap = new(size, size, 96, 96, PixelFormats.Default); 31 | targetBitmap.Render(dVisual); 32 | 33 | return new WriteableBitmap(targetBitmap); 34 | } 35 | 36 | private static ImageSource GetCustomLogoSource(this Brush brush, string filepath) 37 | { 38 | Uri uri = new Uri(filepath); 39 | 40 | if (File.Exists(uri.LocalPath)) 41 | { 42 | BitmapImage logo = new BitmapImage(uri); 43 | 44 | DrawingVisual dVisual = new(); 45 | using (DrawingContext dc = dVisual.RenderOpen()) 46 | { 47 | dc.DrawImage(logo, new Rect(0, 0, logo.Width, logo.Height)); 48 | } 49 | RenderTargetBitmap targetBitmap = new((int)logo.Width, (int)logo.Height, 96, 96, PixelFormats.Default); 50 | targetBitmap.Render(dVisual); 51 | 52 | return new WriteableBitmap(targetBitmap); 53 | } 54 | 55 | // Return empty, file does not exist 56 | return brush.GetEmptyImageSource(); 57 | } 58 | 59 | private static ImageSource GetEmptyImageSource(this Brush brush) 60 | { 61 | return new WriteableBitmap(new RenderTargetBitmap(0, 0, 96, 96, PixelFormats.Default)); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/ExtensionMethods/SolutionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Microsoft.VisualStudio; 3 | using Microsoft.VisualStudio.Shell.Interop; 4 | 5 | namespace SolutionColors 6 | { 7 | internal static class SolutionExtensions 8 | { 9 | private const string _dotslnf = ".slnf"; 10 | 11 | /// 12 | /// Return solution filter (slnf) name if slnf is opened, otherwise return solution (sln) name. 13 | /// 14 | public static async Task GetSolutionNameAsync(this Solution solution) 15 | { 16 | return await GetSlnfFileNameAsync() ?? solution.Name; 17 | } 18 | 19 | /// 20 | /// Return solution filter (slnf) name(!) if slnf is opened, otherwise return solution (sln) path(!). 21 | /// 22 | public static async Task GetSolutionPathAsync(this Solution solution) 23 | { 24 | return await GetSlnfFileNameAsync() ?? solution.FullPath; 25 | } 26 | 27 | private static async Task GetSlnfFileNameAsync() 28 | { 29 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 30 | 31 | //check for opened solution filter (slnf) 32 | //if slnf exists, use it instead of solution name 33 | IVsSolution vss = await VS.Services.GetSolutionAsync(); 34 | ErrorHandler.ThrowOnFailure(vss.GetSolutionInfo(out _, out _, out string optionsFile)); 35 | 36 | if (!string.IsNullOrEmpty(optionsFile) && optionsFile.Contains(_dotslnf)) 37 | { 38 | //cut slnf file name from 39 | int right = optionsFile.LastIndexOf(_dotslnf); 40 | optionsFile = optionsFile.Substring(0, right + _dotslnf.Length); 41 | if (optionsFile.Contains("\\")) 42 | { 43 | int left = optionsFile.LastIndexOf("\\"); 44 | optionsFile = optionsFile.Substring(left + 1); 45 | } 46 | else if (optionsFile.Contains("/")) //visual studio is not a crossplatform app, but for additional sure check the different separator 47 | { 48 | int left = optionsFile.LastIndexOf("/"); 49 | optionsFile = optionsFile.Substring(left + 1); 50 | } 51 | 52 | return optionsFile;//here we use only a slnf NAME, not a slnf PATH, due to: https://developercommunity.visualstudio.com/t/no-way-to-get-path-to-solution-filter-fi/1520237 53 | } 54 | 55 | return null; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/ExtensionMethods/WpfExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace SolutionColors 5 | { 6 | public static class WpfExtensions 7 | { 8 | public static T FindChild(this DependencyObject parent, string childName) where T : DependencyObject 9 | { 10 | if (parent == null) 11 | { 12 | return null; 13 | } 14 | 15 | int childrenCount = VisualTreeHelper.GetChildrenCount(parent); 16 | 17 | for (int i = 0; i < childrenCount; i++) 18 | { 19 | DependencyObject child = VisualTreeHelper.GetChild(parent, i); 20 | 21 | if (child is FrameworkElement frameworkElement && frameworkElement.Name == childName) 22 | { 23 | return frameworkElement as T; 24 | } 25 | } 26 | 27 | for (int i = 0; i < childrenCount; i++) 28 | { 29 | DependencyObject child = VisualTreeHelper.GetChild(parent, i); 30 | 31 | child = FindChild(child, childName); 32 | 33 | if (child != null) 34 | { 35 | return child as T; 36 | } 37 | } 38 | 39 | return null; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/GitHelper.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | 4 | namespace SolutionColors 5 | { 6 | public class GitHelper 7 | { 8 | public static async Task GetBranchNameAsync() 9 | { 10 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 11 | 12 | Solution solution = await VS.Solutions.GetCurrentSolutionAsync(); 13 | 14 | if (solution?.FullPath == null) 15 | { 16 | return "master"; 17 | } 18 | 19 | string rootDir; 20 | 21 | if (solution?.Name?.EndsWith(".wsp") == true) 22 | { 23 | // .wsp is Open Folder and not regular .sln solutions 24 | rootDir = solution.FullPath; 25 | } 26 | else 27 | { 28 | rootDir = Path.GetDirectoryName(solution.FullPath); 29 | } 30 | 31 | DirectoryInfo directoryInfo = new(rootDir); 32 | while (directoryInfo != null) 33 | { 34 | if (directoryInfo != null && Directory.Exists(Path.Combine(directoryInfo.FullName, ".git"))) 35 | { 36 | string content = File.ReadAllText(Path.Combine(directoryInfo.FullName, ".git", "HEAD")); 37 | return content.Replace("ref: refs/heads/", "").Trim(); 38 | } 39 | directoryInfo = System.IO.Directory.GetParent(directoryInfo.FullName); 40 | } 41 | 42 | //if there ist no GIT repo, we always are in main branch 43 | return "master"; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Options/BorderEditor.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Drawing.Design; 3 | using System.Windows.Forms; 4 | using System.Windows.Forms.Design; 5 | 6 | namespace SolutionColors.Options 7 | { 8 | public class BorderEditor : UITypeEditor 9 | { 10 | public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) 11 | { 12 | return UITypeEditorEditStyle.Modal; 13 | } 14 | 15 | public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value) 16 | { 17 | BorderSettings borderSettings = value as BorderSettings; 18 | 19 | //if value is null -> create new 20 | if (value is null) 21 | { 22 | borderSettings = new BorderSettings(); 23 | } 24 | 25 | if (provider.GetService(typeof(IWindowsFormsEditorService)) is IWindowsFormsEditorService svc && borderSettings != null) 26 | { 27 | using (BorderEditorDialog form = new()) 28 | { 29 | form.Borders = borderSettings; 30 | if (svc.ShowDialog(form) == DialogResult.OK) 31 | { 32 | borderSettings = form.Borders; 33 | } 34 | } 35 | } 36 | return value; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Options/BorderEditorDialog.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SolutionColors 2 | { 3 | partial class BorderEditorDialog 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btnTop = new System.Windows.Forms.Button(); 32 | this.btnBottom = new System.Windows.Forms.Button(); 33 | this.btnLeft = new System.Windows.Forms.Button(); 34 | this.btnRight = new System.Windows.Forms.Button(); 35 | this.btnOk = new System.Windows.Forms.Button(); 36 | this.btnCancel = new System.Windows.Forms.Button(); 37 | this.numTop = new System.Windows.Forms.NumericUpDown(); 38 | this.numRight = new System.Windows.Forms.NumericUpDown(); 39 | this.numLeft = new System.Windows.Forms.NumericUpDown(); 40 | this.numBottom = new System.Windows.Forms.NumericUpDown(); 41 | ((System.ComponentModel.ISupportInitialize)(this.numTop)).BeginInit(); 42 | ((System.ComponentModel.ISupportInitialize)(this.numRight)).BeginInit(); 43 | ((System.ComponentModel.ISupportInitialize)(this.numLeft)).BeginInit(); 44 | ((System.ComponentModel.ISupportInitialize)(this.numBottom)).BeginInit(); 45 | this.SuspendLayout(); 46 | // 47 | // btnTop 48 | // 49 | this.btnTop.Location = new System.Drawing.Point(40, 0); 50 | this.btnTop.Name = "btnTop"; 51 | this.btnTop.Size = new System.Drawing.Size(120, 40); 52 | this.btnTop.TabIndex = 0; 53 | this.btnTop.Text = "Top"; 54 | this.btnTop.UseVisualStyleBackColor = true; 55 | this.btnTop.Click += new System.EventHandler(this.btnTop_Click); 56 | // 57 | // btnBottom 58 | // 59 | this.btnBottom.Location = new System.Drawing.Point(40, 160); 60 | this.btnBottom.Name = "btnBottom"; 61 | this.btnBottom.Size = new System.Drawing.Size(120, 40); 62 | this.btnBottom.TabIndex = 1; 63 | this.btnBottom.Text = "Bottom"; 64 | this.btnBottom.UseVisualStyleBackColor = true; 65 | this.btnBottom.Click += new System.EventHandler(this.btnBottom_Click); 66 | // 67 | // btnLeft 68 | // 69 | this.btnLeft.Location = new System.Drawing.Point(0, 40); 70 | this.btnLeft.Name = "btnLeft"; 71 | this.btnLeft.Size = new System.Drawing.Size(40, 120); 72 | this.btnLeft.TabIndex = 2; 73 | this.btnLeft.Text = "Left"; 74 | this.btnLeft.UseVisualStyleBackColor = true; 75 | this.btnLeft.Click += new System.EventHandler(this.btnLeft_Click); 76 | // 77 | // btnRight 78 | // 79 | this.btnRight.Location = new System.Drawing.Point(160, 40); 80 | this.btnRight.Name = "btnRight"; 81 | this.btnRight.Size = new System.Drawing.Size(40, 120); 82 | this.btnRight.TabIndex = 3; 83 | this.btnRight.Text = "Right"; 84 | this.btnRight.UseVisualStyleBackColor = true; 85 | this.btnRight.Click += new System.EventHandler(this.btnRight_Click); 86 | // 87 | // btnOk 88 | // 89 | this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; 90 | this.btnOk.Location = new System.Drawing.Point(113, 218); 91 | this.btnOk.Name = "btnOk"; 92 | this.btnOk.Size = new System.Drawing.Size(75, 23); 93 | this.btnOk.TabIndex = 4; 94 | this.btnOk.Text = "OK"; 95 | this.btnOk.UseVisualStyleBackColor = true; 96 | // 97 | // btnCancel 98 | // 99 | this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 100 | this.btnCancel.Location = new System.Drawing.Point(32, 218); 101 | this.btnCancel.Name = "btnCancel"; 102 | this.btnCancel.Size = new System.Drawing.Size(75, 23); 103 | this.btnCancel.TabIndex = 5; 104 | this.btnCancel.Text = "Cancel"; 105 | this.btnCancel.UseVisualStyleBackColor = true; 106 | // 107 | // numTop 108 | // 109 | this.numTop.Location = new System.Drawing.Point(80, 40); 110 | this.numTop.Maximum = new decimal(new int[] { 111 | 20, 112 | 0, 113 | 0, 114 | 0}); 115 | this.numTop.Minimum = new decimal(new int[] { 116 | 1, 117 | 0, 118 | 0, 119 | 0}); 120 | this.numTop.Name = "numTop"; 121 | this.numTop.Size = new System.Drawing.Size(40, 20); 122 | this.numTop.TabIndex = 6; 123 | this.numTop.Value = new decimal(new int[] { 124 | 1, 125 | 0, 126 | 0, 127 | 0}); 128 | this.numTop.ValueChanged += new System.EventHandler(this.numTop_ValueChanged); 129 | // 130 | // numRight 131 | // 132 | this.numRight.Location = new System.Drawing.Point(120, 92); 133 | this.numRight.Maximum = new decimal(new int[] { 134 | 20, 135 | 0, 136 | 0, 137 | 0}); 138 | this.numRight.Minimum = new decimal(new int[] { 139 | 1, 140 | 0, 141 | 0, 142 | 0}); 143 | this.numRight.Name = "numRight"; 144 | this.numRight.Size = new System.Drawing.Size(40, 20); 145 | this.numRight.TabIndex = 7; 146 | this.numRight.Value = new decimal(new int[] { 147 | 1, 148 | 0, 149 | 0, 150 | 0}); 151 | this.numRight.ValueChanged += new System.EventHandler(this.numRight_ValueChanged); 152 | // 153 | // numLeft 154 | // 155 | this.numLeft.Location = new System.Drawing.Point(40, 92); 156 | this.numLeft.Maximum = new decimal(new int[] { 157 | 20, 158 | 0, 159 | 0, 160 | 0}); 161 | this.numLeft.Minimum = new decimal(new int[] { 162 | 1, 163 | 0, 164 | 0, 165 | 0}); 166 | this.numLeft.Name = "numLeft"; 167 | this.numLeft.Size = new System.Drawing.Size(40, 20); 168 | this.numLeft.TabIndex = 8; 169 | this.numLeft.Value = new decimal(new int[] { 170 | 1, 171 | 0, 172 | 0, 173 | 0}); 174 | this.numLeft.ValueChanged += new System.EventHandler(this.numLeft_ValueChanged); 175 | // 176 | // numBottom 177 | // 178 | this.numBottom.Location = new System.Drawing.Point(80, 140); 179 | this.numBottom.Maximum = new decimal(new int[] { 180 | 20, 181 | 0, 182 | 0, 183 | 0}); 184 | this.numBottom.Minimum = new decimal(new int[] { 185 | 1, 186 | 0, 187 | 0, 188 | 0}); 189 | this.numBottom.Name = "numBottom"; 190 | this.numBottom.Size = new System.Drawing.Size(40, 20); 191 | this.numBottom.TabIndex = 9; 192 | this.numBottom.Value = new decimal(new int[] { 193 | 1, 194 | 0, 195 | 0, 196 | 0}); 197 | this.numBottom.ValueChanged += new System.EventHandler(this.numBottom_ValueChanged); 198 | // 199 | // BorderEditorDialog 200 | // 201 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 202 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 203 | this.AutoSize = true; 204 | this.ClientSize = new System.Drawing.Size(216, 291); 205 | this.ControlBox = false; 206 | this.Controls.Add(this.numBottom); 207 | this.Controls.Add(this.numLeft); 208 | this.Controls.Add(this.numRight); 209 | this.Controls.Add(this.numTop); 210 | this.Controls.Add(this.btnCancel); 211 | this.Controls.Add(this.btnOk); 212 | this.Controls.Add(this.btnRight); 213 | this.Controls.Add(this.btnLeft); 214 | this.Controls.Add(this.btnBottom); 215 | this.Controls.Add(this.btnTop); 216 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 217 | this.Name = "BorderEditorDialog"; 218 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 219 | this.Text = "Border settings"; 220 | this.Load += new System.EventHandler(this.BorderEditorDialog_Load); 221 | ((System.ComponentModel.ISupportInitialize)(this.numTop)).EndInit(); 222 | ((System.ComponentModel.ISupportInitialize)(this.numRight)).EndInit(); 223 | ((System.ComponentModel.ISupportInitialize)(this.numLeft)).EndInit(); 224 | ((System.ComponentModel.ISupportInitialize)(this.numBottom)).EndInit(); 225 | this.ResumeLayout(false); 226 | 227 | } 228 | 229 | #endregion 230 | 231 | private System.Windows.Forms.Button btnTop; 232 | private System.Windows.Forms.Button btnBottom; 233 | private System.Windows.Forms.Button btnLeft; 234 | private System.Windows.Forms.Button btnRight; 235 | private System.Windows.Forms.Button btnOk; 236 | private System.Windows.Forms.Button btnCancel; 237 | private System.Windows.Forms.NumericUpDown numTop; 238 | private System.Windows.Forms.NumericUpDown numRight; 239 | private System.Windows.Forms.NumericUpDown numLeft; 240 | private System.Windows.Forms.NumericUpDown numBottom; 241 | } 242 | } -------------------------------------------------------------------------------- /src/Options/BorderEditorDialog.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | using SolutionColors.Options; 3 | 4 | namespace SolutionColors 5 | { 6 | public partial class BorderEditorDialog : Form 7 | { 8 | private BorderSettings _borderSettings; 9 | 10 | public BorderSettings Borders 11 | { 12 | get { return _borderSettings; } 13 | set { _borderSettings = value; } 14 | } 15 | 16 | public BorderEditorDialog() 17 | { 18 | ShowInTaskbar = false; 19 | InitializeComponent(); 20 | } 21 | 22 | private void BorderEditorDialog_Load(object sender, EventArgs e) 23 | { 24 | SetButton(btnBottom, Borders.BorderDetails.Locations.HasFlag(BorderLocation.Bottom)); 25 | SetButton(btnLeft, Borders.BorderDetails.Locations.HasFlag(BorderLocation.Left)); 26 | SetButton(btnRight, Borders.BorderDetails.Locations.HasFlag(BorderLocation.Right)); 27 | SetButton(btnTop, Borders.BorderDetails.Locations.HasFlag(BorderLocation.Top)); 28 | numBottom.Value = Borders.BorderDetails.WidthBottom; 29 | numLeft.Value = Borders.BorderDetails.WidthLeft; 30 | numRight.Value = Borders.BorderDetails.WidthRight; 31 | numTop.Value = Borders.BorderDetails.WidthTop; 32 | } 33 | 34 | 35 | private void SetButton(Button button, bool isSet) 36 | { 37 | if (isSet) 38 | { 39 | button.ForeColor = System.Drawing.SystemColors.ControlText; 40 | button.BackColor = System.Drawing.SystemColors.ControlDark; 41 | } 42 | else 43 | { 44 | button.ForeColor = System.Drawing.SystemColors.ControlDark; 45 | button.BackColor = System.Drawing.SystemColors.ControlLightLight; 46 | } 47 | } 48 | 49 | private void btnBottom_Click(object sender, EventArgs e) 50 | { 51 | ToggleLocation(BorderLocation.Bottom); 52 | SetButton((Button)sender, Borders.BorderDetails.Locations.HasFlag(BorderLocation.Bottom)); 53 | } 54 | 55 | private void btnLeft_Click(object sender, EventArgs e) 56 | { 57 | ToggleLocation(BorderLocation.Left); 58 | SetButton((Button)sender, Borders.BorderDetails.Locations.HasFlag(BorderLocation.Left)); 59 | } 60 | 61 | private void btnRight_Click(object sender, EventArgs e) 62 | { 63 | ToggleLocation(BorderLocation.Right); 64 | SetButton((Button)sender, Borders.BorderDetails.Locations.HasFlag(BorderLocation.Right)); 65 | } 66 | 67 | private void btnTop_Click(object sender, EventArgs e) 68 | { 69 | ToggleLocation(BorderLocation.Top); 70 | SetButton((Button)sender, Borders.BorderDetails.Locations.HasFlag(BorderLocation.Top)); 71 | } 72 | 73 | 74 | private void ToggleLocation(BorderLocation location) 75 | { 76 | if (Borders.BorderDetails.Locations.HasFlag(location)) 77 | { 78 | Borders.BorderDetails.Locations &= ~location; 79 | } 80 | else 81 | { 82 | Borders.BorderDetails.Locations = Borders.BorderDetails.Locations | location; 83 | } 84 | } 85 | 86 | private void numBottom_ValueChanged(object sender, EventArgs e) 87 | { 88 | Borders.BorderDetails.WidthBottom = (int)((NumericUpDown)sender).Value; 89 | } 90 | 91 | private void numLeft_ValueChanged(object sender, EventArgs e) 92 | { 93 | Borders.BorderDetails.WidthLeft = (int)((NumericUpDown)sender).Value; 94 | } 95 | 96 | private void numRight_ValueChanged(object sender, EventArgs e) 97 | { 98 | Borders.BorderDetails.WidthRight = (int)((NumericUpDown)sender).Value; 99 | } 100 | 101 | private void numTop_ValueChanged(object sender, EventArgs e) 102 | { 103 | Borders.BorderDetails.WidthTop = (int)((NumericUpDown)sender).Value; 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/Options/BorderEditorDialog.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /src/Options/BorderSettings.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Drawing.Design; 3 | 4 | namespace SolutionColors.Options 5 | { 6 | [Editor(typeof(BorderEditor), typeof(UITypeEditor))] 7 | [TypeConverter(typeof(ExpandableObjectConverter))] 8 | public class BorderSettings 9 | { 10 | private BorderDetails _borderDetails = new(); 11 | 12 | [Browsable(false)] 13 | public BorderDetails BorderDetails 14 | { 15 | get { return _borderDetails; } 16 | set { _borderDetails = value; } 17 | } 18 | } 19 | 20 | public class BorderDetails 21 | { 22 | public BorderLocation Locations = BorderLocation.Bottom; 23 | public int WidthBottom { get; set; } = 3; 24 | public int WidthLeft { get; set; } = 3; 25 | public int WidthRight { get; set; } = 3; 26 | public int WidthTop { get; set; } = 3; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Options/BorderTypeConverter.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Globalization; 3 | 4 | namespace SolutionColors.Options 5 | { 6 | public class BorderTypeConverter : TypeConverter 7 | { 8 | public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) 9 | { 10 | if (destinationType == typeof(string)) 11 | { 12 | return "(Border settings)"; 13 | } 14 | 15 | return base.ConvertTo(context, culture, value, destinationType); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Options/EnumDescriptionConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace SolutionColors.Options 11 | { 12 | class EnumDescriptionConverter : EnumConverter 13 | { 14 | private Type _enumType; 15 | 16 | public EnumDescriptionConverter(Type type) : base(type) 17 | { 18 | _enumType = type; 19 | } 20 | 21 | public override bool CanConvertTo(ITypeDescriptorContext context, Type destType) 22 | { 23 | return destType == typeof(string); 24 | } 25 | 26 | public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, 27 | object value, Type destType) 28 | { 29 | FieldInfo fi = _enumType.GetField(Enum.GetName(_enumType, value)); 30 | DescriptionAttribute dna = (DescriptionAttribute)Attribute.GetCustomAttribute(fi, 31 | typeof(DescriptionAttribute)); 32 | if (dna != null) 33 | return dna.Description; 34 | else 35 | return value.ToString(); 36 | } 37 | 38 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type srcType) 39 | { 40 | return srcType == typeof(string); 41 | } 42 | 43 | public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, 44 | object value) 45 | { 46 | foreach (FieldInfo fi in _enumType.GetFields()) 47 | { 48 | DescriptionAttribute dna = (DescriptionAttribute)Attribute.GetCustomAttribute(fi, 49 | typeof(DescriptionAttribute)); 50 | if ((dna != null) && ((string)value == dna.Description)) 51 | return Enum.Parse(_enumType, fi.Name); 52 | } 53 | return Enum.Parse(_enumType, (string)value); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Options/FileSelectorDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Drawing.Design; 4 | using System.Globalization; 5 | using System.Windows.Forms; 6 | 7 | namespace SolutionColors.Options 8 | { 9 | [Editor(typeof(FilePathEditor), typeof(UITypeEditor))] 10 | [TypeConverter(typeof(FileSelectorSettingConverter))] 11 | public class FileSelectorSetting 12 | { 13 | [Browsable(false)] 14 | public string FilePath { get; set; } 15 | } 16 | 17 | // Custom UITypeEditor for file path 18 | public class FilePathEditor : UITypeEditor 19 | { 20 | public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) 21 | { 22 | return UITypeEditorEditStyle.Modal; 23 | } 24 | 25 | public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) 26 | { 27 | OpenFileDialog openFileDialog = new OpenFileDialog(); 28 | 29 | // Filetypes that are supported by BitmapImage 30 | openFileDialog.Filter = "Image Files|*.bmp;*.jpg;*.jpeg;*.gif;*.png;*.ico;*.tif;*.tiff;*.wdp;*.raw"; 31 | openFileDialog.Title = "Please select an Image file"; 32 | 33 | if (openFileDialog.ShowDialog() == DialogResult.OK) 34 | { 35 | return new FileSelectorSetting { FilePath = openFileDialog.FileName }; 36 | } 37 | return value; 38 | } 39 | } 40 | 41 | public class FileSelectorSettingConverter : TypeConverter 42 | { 43 | public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) 44 | { 45 | if (destinationType == typeof(string) && value is FileSelectorSetting fileSelectorSetting) 46 | { 47 | return fileSelectorSetting.FilePath; 48 | } 49 | return base.ConvertTo(context, culture, value, destinationType); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/Options/General.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Globalization; 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | using SolutionColors.Options; 6 | 7 | namespace SolutionColors 8 | { 9 | internal partial class OptionsProvider 10 | { 11 | [ComVisible(true)] 12 | public class GeneralOptions : BaseOptionPage { } 13 | } 14 | 15 | public class General : BaseOptionModel, IRatingConfig 16 | { 17 | [Category("General")] 18 | [DisplayName("Automatic")] 19 | [Description("Automatically assign and apply a color to solutions as they open. You can still manually assign colors when needed. Default: false")] 20 | [DefaultValue(false)] 21 | public bool AutoMode { get; set; } 22 | 23 | [Category("General")] 24 | [DisplayName("Show on taskbar thumbnails")] 25 | [Description("Determines if the color icon should be shown in the taskbar thumbnails. Default: MainWindowOnly")] 26 | [DefaultValue(TaskBarOptions.MainWindowOnly)] 27 | public TaskBarOptions ShowTaskBarThumbnails { get; set; } = TaskBarOptions.MainWindowOnly; 28 | 29 | [Category("General")] 30 | [DisplayName("Show on taskbar icons")] 31 | [Description("Determines if the color icon should be shown in the taskbar icon itself. Only works when taskbar items are ungrouped. Default: false")] 32 | [DefaultValue(false)] 33 | public bool ShowTaskBarOverlay { get; set; } 34 | 35 | [Category("General")] 36 | [DisplayName("Show on title bar")] 37 | [Description("Determines if solution/folder name on the title bar should be colorized. Default: true")] 38 | [DefaultValue(true)] 39 | public bool ShowTitleBar { get; set; } = true; 40 | 41 | [Category("General")] 42 | [DisplayName("Save settings file in root folder")] 43 | [Description("Determines if the settings file should be saved in the root folder or in the .vs folder. Default: false")] 44 | [DefaultValue(false)] 45 | public bool SaveInRoot { get; set; } = false; 46 | 47 | [Category("General")] 48 | [DisplayName("Border settings")] 49 | [Description("Sets border locations and width in pixels. Default: bottom 3")] 50 | [TypeConverter(typeof(BorderTypeConverter))] 51 | public BorderSettings Borders { get; set; } = new BorderSettings(); 52 | 53 | [Category("General")] 54 | [DisplayName("Coloration")] 55 | [Description("Determines the coloration for branches. Default: unitary")] 56 | [TypeConverter(typeof(EnumDescriptionConverter))] 57 | [DefaultValue(Coloration.Unitary)] 58 | public Coloration Coloration { get; set; } = Coloration.Unitary; 59 | 60 | [Category("General")] 61 | [DisplayName("Base Color")] 62 | [Description("Determines the color for titlebar, taskbar icon and thumbnails if respective gradient is set to false. Default: master")] 63 | [TypeConverter(typeof(EnumDescriptionConverter))] 64 | [DefaultValue(BaseColor.MasterColor)] 65 | public BaseColor BaseColor { get; set; } = BaseColor.MasterColor; 66 | 67 | [Category("General")] 68 | [DisplayName("Gradient in taskbar (thumbnail and icon)")] 69 | [Description("Determines if the thumbnails and icons should have a linear gradient (only for branches and if Coloration is set to combined). Default: false")] 70 | [DefaultValue(false)] 71 | public bool UseGradientTaskbar { get; set; } = false; 72 | 73 | [Category("General")] 74 | [DisplayName("Gradient in titlebar")] 75 | [Description("Determines if titlebar should have a linear gradient (only for branches and if Coloration is set to combined). Default: false")] 76 | [DefaultValue(false)] 77 | public bool UseGradientTitlebar { get; set; } = false; 78 | 79 | [Category("General")] 80 | [DisplayName("Gradient in borders")] 81 | [Description("Determines the type of gradient for borders (only for branches and if Coloration is set to combined). Default: radial gradient")] 82 | [TypeConverter(typeof(EnumDescriptionConverter))] 83 | [DefaultValue(Gradient.RadialGradient)] 84 | public Gradient GradientBorders { get; set; } = Gradient.RadialGradient; 85 | 86 | [Category("General")] 87 | [DisplayName("Taskbar Icon Mode")] 88 | [Description("Determines if taskbar icon is a colored square or custom icon.")] 89 | [DefaultValue("")] 90 | public IconMode TaskbarIconMode { get; set; } 91 | 92 | [Category("General")] 93 | [DisplayName("Custom Taskbar Icon")] 94 | [Description("File path of the custom icon that should be displayed if Icon Mode is set to custom.")] 95 | [DefaultValue("")] 96 | public FileSelectorSetting CustomTaskBarIconPath { get; set; } = new FileSelectorSetting(); 97 | 98 | [Browsable(false)] 99 | public int RatingRequests { get; set; } 100 | 101 | } 102 | 103 | [Flags] 104 | public enum BorderLocation 105 | { 106 | Bottom = 1, 107 | Left = 2, 108 | Right = 4, 109 | Top = 8 110 | } 111 | 112 | public enum BaseColor 113 | { 114 | [Description("Master color")] 115 | MasterColor = 1, 116 | [Description("Branch color")] 117 | BranchColor = 2 118 | } 119 | 120 | public enum IconMode 121 | { 122 | [Description("Colored Square")] 123 | ColoredSquare = 1, 124 | [Description("Custom Icon")] 125 | CustomIcon = 2 126 | } 127 | 128 | public enum Coloration 129 | { 130 | [Description("Unitary (only one color for all branches)")] 131 | Unitary = 1, 132 | [Description("Color per branch")] 133 | Branch = 2, 134 | [Description("Combined (gradient coloring)")] 135 | Combined = 3 136 | } 137 | 138 | public enum Gradient 139 | { 140 | [Description("Linear gradient")] 141 | LinearGradient = 1, 142 | [Description("Radial gradient")] 143 | RadialGradient = 2 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/Options/TaskBarOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SolutionColors.Options 8 | { 9 | public enum TaskBarOptions 10 | { 11 | None, 12 | MainWindowOnly, 13 | AllWindows 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using SolutionColors; 2 | 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | [assembly: AssemblyTitle(Vsix.Name)] 7 | [assembly: AssemblyDescription(Vsix.Description)] 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany(Vsix.Author)] 10 | [assembly: AssemblyProduct(Vsix.Name)] 11 | [assembly: AssemblyCopyright(Vsix.Author)] 12 | [assembly: AssemblyTrademark("")] 13 | [assembly: AssemblyCulture("")] 14 | 15 | [assembly: ComVisible(false)] 16 | 17 | [assembly: AssemblyVersion(Vsix.Version)] 18 | [assembly: AssemblyFileVersion(Vsix.Version)] 19 | 20 | namespace System.Runtime.CompilerServices 21 | { 22 | public class IsExternalInit { } 23 | } -------------------------------------------------------------------------------- /src/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/SolutionColors/5cb8d00a06546b4d35f0c88690f884cd7b8bc740/src/Resources/Icon.png -------------------------------------------------------------------------------- /src/SolutionColors.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 5 | latest 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 2.0 12 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 13 | {1661127A-05A1-4935-B885-6D7CE4D1E57E} 14 | Library 15 | Properties 16 | SolutionColors 17 | SolutionColors 18 | v4.8 19 | true 20 | true 21 | true 22 | true 23 | false 24 | true 25 | true 26 | Program 27 | $(DevEnvDir)devenv.exe 28 | /rootsuffix Exp 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | Form 59 | 60 | 61 | BorderEditorDialog.cs 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | True 75 | True 76 | source.extension.vsixmanifest 77 | 78 | 79 | 80 | True 81 | True 82 | VSCommandTable.vsct 83 | 84 | 85 | 86 | 87 | Resources\LICENSE 88 | true 89 | 90 | 91 | Designer 92 | VsixManifestGenerator 93 | source.extension.cs 94 | 95 | 96 | true 97 | 98 | 99 | 100 | 101 | Menus.ctmenu 102 | VsctGenerator 103 | VSCommandTable.cs 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | compile; build; native; contentfiles; analyzers; buildtransitive 119 | 120 | 121 | 16.4.78 122 | 123 | 124 | 16.0.59 125 | compile; build; native; contentfiles; analyzers; buildtransitive 126 | 127 | 128 | runtime; build; native; contentfiles; analyzers; buildtransitive 129 | all 130 | 131 | 132 | 133 | 134 | BorderEditorDialog.cs 135 | 136 | 137 | 138 | 139 | 146 | -------------------------------------------------------------------------------- /src/SolutionColorsPackage.cs: -------------------------------------------------------------------------------- 1 | global using System; 2 | global using Community.VisualStudio.Toolkit; 3 | global using Microsoft.VisualStudio.Shell; 4 | global using Task = System.Threading.Tasks.Task; 5 | using System.Runtime.InteropServices; 6 | using System.Threading; 7 | using Microsoft.VisualStudio; 8 | 9 | namespace SolutionColors 10 | { 11 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 12 | [InstalledProductRegistration(Vsix.Name, Vsix.Description, Vsix.Version)] 13 | [ProvideMenuResource("Menus.ctmenu", 1)] 14 | [ProvideOptionPage(typeof(OptionsProvider.GeneralOptions), "Environment", "Fonts and Colors\\Solution Colors", 0, 0, true, SupportsProfiles = true, ProvidesLocalizedCategoryName = false)] 15 | [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionHasSingleProject_string, PackageAutoLoadFlags.BackgroundLoad)] 16 | [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionHasMultipleProjects_string, PackageAutoLoadFlags.BackgroundLoad)] 17 | [ProvideAutoLoad(VSConstants.UICONTEXT.FolderOpened_string, PackageAutoLoadFlags.BackgroundLoad)] 18 | [Guid(PackageGuids.SolutionColorsString)] 19 | public sealed class SolutionColorsPackage : ToolkitPackage 20 | { 21 | private RatingPrompt _ratingPrompt; 22 | 23 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 24 | { 25 | await this.RegisterCommandsAsync(); 26 | 27 | _ratingPrompt = new RatingPrompt("MadsKristensen.SolutionColors", Vsix.Name, General.Instance, 10); 28 | 29 | if (await VS.Solutions.IsOpenAsync()) 30 | { 31 | HandleOpenSolution(); 32 | } 33 | 34 | await JoinableTaskFactory.SwitchToMainThreadAsync(); 35 | 36 | 37 | VS.Events.SolutionEvents.OnAfterOpenSolution += HandleOpenSolution; 38 | VS.Events.SolutionEvents.OnAfterCloseSolution += HandleCloseSolution; 39 | VS.Events.SolutionEvents.OnAfterOpenFolder += HandleOpenFolder; 40 | VS.Events.SolutionEvents.OnAfterCloseFolder += HandleCloseFolder; 41 | General.Saved += SettingsSaved; 42 | } 43 | 44 | private void SettingsSaved(General obj) 45 | { 46 | JoinableTaskFactory.RunAsync(async () => 47 | { 48 | await JoinableTaskFactory.SwitchToMainThreadAsync(); 49 | await ColorHelper.ResetAsync(); 50 | }).FireAndForget(); 51 | } 52 | 53 | private void HandleOpenFolder(string obj) => 54 | HandleOpenSolution(); 55 | 56 | private void HandleCloseFolder(string obj) => 57 | HandleCloseSolution(); 58 | 59 | private void HandleCloseSolution() => 60 | ColorHelper.RemoveUIAsync().FireAndForget(); 61 | 62 | private void HandleOpenSolution(Solution sol = null) 63 | { 64 | JoinableTaskFactory.RunAsync(async () => 65 | { 66 | await JoinableTaskFactory.SwitchToMainThreadAsync(); 67 | 68 | await ColorHelper.ResetInstanceAsync(); 69 | 70 | string colorMaster = await ColorHelper.GetColorAsync("master"); 71 | 72 | General options = await General.GetLiveInstanceAsync(); 73 | 74 | if (!string.IsNullOrEmpty(colorMaster) || options.AutoMode == true) 75 | { 76 | await ColorHelper.ColorizeAsync(); 77 | await Task.Delay(2000); 78 | _ratingPrompt.RegisterSuccessfulUsage(); 79 | } 80 | }).FireAndForget(); 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /src/Telemetry.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Telemetry; 2 | 3 | namespace SolutionColors 4 | { 5 | public class Telemetry 6 | { 7 | private const string _namespace = "VS/Extension/" + Vsix.Name + "/"; 8 | 9 | public static TelemetryEvent CreateEvent(string name) 10 | { 11 | return new TelemetryEvent(CleanName(name)); 12 | } 13 | 14 | public static void TrackEvent(TelemetryEvent telemetryEvent) 15 | { 16 | TelemetryService.DefaultSession.PostEvent(telemetryEvent); 17 | } 18 | 19 | public static void TrackUserTask(string name, TelemetryResult result = TelemetryResult.Success) 20 | { 21 | TelemetryService.DefaultSession.PostUserTask(CleanName(name), result); 22 | } 23 | 24 | //public static void TrackOperation(string name, string details = "", TelemetryResult result = TelemetryResult.Success) 25 | //{ 26 | // TelemetryService.DefaultSession.PostOperation(CleanName(name), result, details); 27 | //} 28 | 29 | //public static void TrackException(string name, Exception exception) 30 | //{ 31 | // if (string.IsNullOrWhiteSpace(name) || exception == null) 32 | // { 33 | // return; 34 | // } 35 | 36 | // TelemetryService.DefaultSession.PostFault(CleanName(name), exception.Message, exception); 37 | //} 38 | 39 | private static string CleanName(string name) 40 | { 41 | return (_namespace + name).Replace(" ", "_"); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/VSCommandTable.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace SolutionColors 7 | { 8 | using System; 9 | 10 | /// 11 | /// Helper class that exposes all GUIDs used across VS Package. 12 | /// 13 | internal sealed partial class PackageGuids 14 | { 15 | public const string SolutionColorsString = "3a113b17-c53c-45f0-baab-571abef8b325"; 16 | public static Guid SolutionColors = new Guid(SolutionColorsString); 17 | 18 | public const string guidWorkspaceExplorerToolWindowPackageCmdSetString = "cfb400f1-5c60-4f3c-856e-180d28def0b7"; 19 | public static Guid guidWorkspaceExplorerToolWindowPackageCmdSet = new Guid(guidWorkspaceExplorerToolWindowPackageCmdSetString); 20 | 21 | public const string TabColorsString = "a1fa08e5-519b-4810-bdb0-89f586af37e9"; 22 | public static Guid TabColors = new Guid(TabColorsString); 23 | } 24 | /// 25 | /// Helper class that encapsulates all CommandIDs uses across VS Package. 26 | /// 27 | internal sealed partial class PackageIds 28 | { 29 | public const int OuterGroup = 0x0001; 30 | public const int InnerGroup = 0x0002; 31 | public const int NoneGroup = 0x0003; 32 | public const int AnyCodeGroup = 0x0004; 33 | public const int OptionsGroup = 0x0005; 34 | public const int FlyoutMenu = 0x1000; 35 | public const int Lavender = 0x0100; 36 | public const int Gold = 0x0101; 37 | public const int Cyan = 0x0102; 38 | public const int Burgundy = 0x0103; 39 | public const int Green = 0x0104; 40 | public const int Brown = 0x0105; 41 | public const int RoyalBlue = 0x0106; 42 | public const int Pumpkin = 0x0107; 43 | public const int Gray = 0x0108; 44 | public const int Volt = 0x0109; 45 | public const int Teal = 0x0110; 46 | public const int Magenta = 0x0111; 47 | public const int Mint = 0x0112; 48 | public const int DarkBrown = 0x0113; 49 | public const int Blue = 0x0114; 50 | public const int Pink = 0x0115; 51 | public const int Custom = 0x0190; 52 | public const int None = 0x0200; 53 | public const int Options = 0x0300; 54 | public const int idmWSE_ContextMenu = 0x0002; 55 | public const int cLavender = 0x0001; 56 | public const int cGold = 0x0002; 57 | public const int cCyan = 0x0003; 58 | public const int cBurgundy = 0x0004; 59 | public const int cGreen = 0x0005; 60 | public const int cBrown = 0x0006; 61 | public const int cRoyalBlue = 0x0007; 62 | public const int cPumpkin = 0x0008; 63 | public const int cGray = 0x0009; 64 | public const int cVolt = 0x000A; 65 | public const int cTeal = 0x000B; 66 | public const int cMagenta = 0x000C; 67 | public const int cMint = 0x000D; 68 | public const int cDarkBrown = 0x000E; 69 | public const int cBlue = 0x000F; 70 | public const int cPink = 0x0010; 71 | } 72 | } -------------------------------------------------------------------------------- /src/VSCommandTable.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | DynamicVisibility 14 | 15 | Set Solution Color 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 51 | 61 | 71 | 81 | 91 | 101 | 111 | 121 | 131 | 141 | 151 | 161 | 171 | 181 | 191 | 201 | 202 | 211 | 212 | 222 | 223 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | -------------------------------------------------------------------------------- /src/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace SolutionColors 7 | { 8 | internal sealed partial class Vsix 9 | { 10 | public const string Id = "SolutionColors.dfa813d0-736b-491d-921a-4a3503d41543"; 11 | public const string Name = "Solution Colors"; 12 | public const string Description = @"Allows you to associate a color with a solution and display it in various locations within Visual Studio. Inspired by the Peacock extension for VS Code."; 13 | public const string Language = "en-US"; 14 | public const string Version = "1.1.999"; 15 | public const string Author = "Mads Kristensen"; 16 | public const string Tags = "colors, solution, peacock"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Solution Colors 6 | Allows you to associate a color with a solution and display it in various locations within Visual Studio. Inspired by the Peacock extension for VS Code. 7 | https://github.com/madskristensen/SolutionColors 8 | Resources\LICENSE 9 | Resources\Icon.png 10 | Resources\Icon.png 11 | colors, solution, peacock 12 | 13 | 14 | 15 | amd64 16 | 17 | 18 | arm64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /vs-publish.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/vsix-publish", 3 | "categories": [ "web" ], 4 | "identity": { 5 | "internalName": "SolutionColors", 6 | "tags": [ "color", "solution", "peacock" ] 7 | }, 8 | "assetFiles": [ 9 | { 10 | "pathOnDisk": "art/colors.png", 11 | "targetPath": "art/colors.png" 12 | }, 13 | { 14 | "pathOnDisk": "art/options.png", 15 | "targetPath": "art/options.png" 16 | }, 17 | { 18 | "pathOnDisk": "art/context-menu.png", 19 | "targetPath": "art/context-menu.png" 20 | }, 21 | { 22 | "pathOnDisk": "art/context-menu-none.png", 23 | "targetPath": "art/context-menu-none.png" 24 | }, 25 | { 26 | "pathOnDisk": "art/context-menu-disable.png", 27 | "targetPath": "art/context-menu-disable.png" 28 | }, 29 | { 30 | "pathOnDisk": "art/taskbar.png", 31 | "targetPath": "art/taskbar.png" 32 | }, 33 | { 34 | "pathOnDisk": "art/taskbar-icons.png", 35 | "targetPath": "art/taskbar-icons.png" 36 | }, 37 | { 38 | "pathOnDisk": "art/solution-label.png", 39 | "targetPath": "art/solution-label.png" 40 | }, 41 | { 42 | "pathOnDisk": "art/top.png", 43 | "targetPath": "art/top.png" 44 | }, 45 | { 46 | "pathOnDisk": "art/custom-colors.png", 47 | "targetPath": "art/custom-colors.png" 48 | }, 49 | { 50 | "pathOnDisk": "art/border-settings.png", 51 | "targetPath": "art/border-settings.png" 52 | }, 53 | { 54 | "pathOnDisk": "art/solution-context-menu.png", 55 | "targetPath": "art/solution-context-menu.png" 56 | } 57 | ], 58 | "overview": "README.md", 59 | "publisher": "MadsKristensen", 60 | "repo": "https://github.com/MadsKristensen/SolutionColors" 61 | } 62 | --------------------------------------------------------------------------------