This is a migrated thread and some comments may be shown as answers.

Turn off opacity in Fluent theme

2 Answers 462 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 1
Stefan asked on 19 Jan 2018, 08:07 AM

Hi,

Is there a way to turn off the opacity in the new Fluent theme?

2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 19 Jan 2018, 09:48 AM
Hello,

Depending on which opacity you are referring. There is opacity to some of the brushes as well as opacity on the text of the inputs. Each of these can be controlled via properties in the FluentPalette.Palette static class. 

You can use the following method to overlay any color on top of a background color to receive an opaque variation of it:
public static Color RgbFromArgbAndBackgroundColor(Color targetColor, Color backgroundColor)
{
    var baseAlpha = targetColor.A / 255.0;
    var reverseAlpha = 1.0 - baseAlpha;
    byte redValue = (byte)((targetColor.R * baseAlpha) + (backgroundColor.R * reverseAlpha));
    byte greenValue = (byte)((targetColor.G * baseAlpha) + (backgroundColor.G * reverseAlpha));
    byte blueValue = (byte)((targetColor.B * baseAlpha) + (backgroundColor.B * reverseAlpha));
 
    return Color.FromArgb(255, redValue, greenValue, blueValue);
}

For example with the MainColor:
Color mainColor = FluentPalette.Palette.MainColor;
FluentPalette.Palette.MainColor = RgbFromArgbAndBackgroundColor(mainColor, FluentPalette.Palette.PrimaryBackgroundColor);

The ones that you might need to change as well are PrimaryColor, MouseOverColor, PressedColor and BasicColor (although there is a variation of is - BasicSolidColor). There is also FluentPalette.Palette.InputOpacity, which is responsible for the normal state of text in the inputs as is defaulting to 0.6.

If you are referring to the opacity of Windows and popups (if you do not have the IsAcrylic effect available on the current machine or simply you would like to remove it), you can set in the static constructor of the MainWindow:

ThemeEffectsHelper.IsAcrylicEnabled = false;

I hope that any of these would be helpful to you in customizing the theme to fit your needs. If you have any other questions, please do not hesitate to contact us further.

Regards,
Martin
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Stefan
Top achievements
Rank 1
answered on 19 Jan 2018, 10:12 AM

Hi Martin,

Thanks for the quick reply.

It was the opacity of Windows and popups I wanted to turn off. Setting ThemeEffectsHelper.IsAcrylicEnabled = false worked perfect.

Best regards Stefan

Tags
General Discussions
Asked by
Stefan
Top achievements
Rank 1
Answers by
Martin
Telerik team
Stefan
Top achievements
Rank 1
Share this question
or