Tabs Studio Blog (organizing Visual Studio document tabs)

April 10, 2019

Tab coloring rules generator

Filed under: Uncategorized — Tags: — Sergey Vlasov @ 10:07 am

The Tab coloring rule dialog lets you conveniently define background and foreground colors for a tab matching specific criteria:

The same rule can be also defined as an XAML Tabs style:

<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
    <Style.Triggers>
        <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding Path=Paths, RelativeSource={RelativeSource Self}, 
                		Converter={StaticResource RegexMatch},ConverterParameter='WpfApp1'}" Value="True"/>
                <Condition Binding="{Binding Path=IsTabSelected, RelativeSource={RelativeSource Self}}" Value="True"/>
            </MultiDataTrigger.Conditions>
            <Setter Property="Background">
                <Setter.Value>
                     <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Color="#e87400" Offset="0"/> <GradientStop Color="#0089E1" Offset="1"/> </LinearGradientBrush>
                </Setter.Value>
            </Setter>  
            <Setter Property="Foreground">
                <Setter.Value>
                     <SolidColorBrush Color="White"/>
                </Setter.Value>
            </Setter>  
        </MultiDataTrigger>
    </Style.Triggers>
</Style>

If you have many similar tab coloring rules, instead of using the Tab coloring rule dialog you may consider generating an XAML style programmatically and then copy it to Tabs Studio.

TStyle.zip is a sample project for Visual Studio 2019 using a T4 Text Template that generates 3 styles for a project tab, selected project tab and previously selected project tab given a project path and a base background color. If you want to define these styles for multiple projects, in the tab.tt file just add a path-color pair to the dictionary, save the file and copy generated tab.txt file contents as Tabs style:

<# var rules = new Dictionary<string, string> { {"WebApplication1", "#800000"}, {"WpfApp1", "#e87400"} }; #>

2 Comments

  1. Any chance you could create an add-on that would default auto-coloring for projects by index the way Custom Document Well? I discovered this product due to your posts in the the various VS feature requests since Custom Document Well doesn’t work in VS 2019. I’m interested in purchasing this because I can see that I’d use several of the other features, but I work in several different solutions containing several projects each and that’s a lot of colors to set up. It would be awesome if it had default colors by indexed projects the way that Custom Document Well has by default. That’s the only feature missing that I use from Custom Document Well.

    Comment by Jason Seeley — May 1, 2019 @ 7:28 pm


RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Blog at WordPress.com.

%d bloggers like this: