Highlight color in VisualStudio 2019 theme

1 Answer 369 Views
Window
Gonzalo
Top achievements
Rank 1
Gonzalo asked on 18 Feb 2022, 03:17 AM

In VS2019 theme the highlight color for selected text in several controls is so light that is very difficult to tell if the text is selected or not.

You can see this in controls like MS Textbox or RadWaterMarkTextbox,

It looks like that the color used is the accentcolor property of the theme with certain opacity. The problem is that i don't know how to change this opacity.

I'm attaching two screen captures showing this, both of them from Telerik Color Theme Generator.

How can I change this color?

 

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 22 Feb 2022, 10:49 AM

Hello Gonzalo,

Generally speaking, the selection color and opacity could be controlled through the SelectionOpacity and SelectionBrush properties, which are defined inside the TextBoxBase abstract class. Any class that derives from it could modify these properties' values.

With that said, to change the selection color and the opacity, you could create a new Style and for the TargetType, set the control that needs to be directly targeted, because the custom controls will not automatically receive the inherited control's style (this could be observed when a style with TargetType="TextBox" is defined, and the RadWaterMarkTextBox control would not be affected by it).

The following code snippet shows sample styles for both the TextBox and RadWatermarkTextBox controls:

<Window.Resources>
    <!--Set the BasedOn property if NoXaml assemblies are used BasedOn="{StaticResource TextBoxStyle}"-->
    <Style TargetType="TextBox">
        <Setter Property="SelectionOpacity" Value="0.6"/>
        <Setter Property="SelectionBrush" Value="Red"/>
    </Style>
    <!--Set the BasedOn property if NoXaml assemblies are used BasedOn="{StaticResource RadWatermarkTextBoxStyle}"-->
    <Style TargetType="telerik:RadWatermarkTextBox">
        <Setter Property="SelectionOpacity" Value="0.6"/>
        <Setter Property="SelectionBrush" Value="Red"/>
    </Style>
</Window.Resources>

I hope the provided information is of help to you.

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Window
Asked by
Gonzalo
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or