Windows 10 ではOS のアクセントカラーを選択することが出来ます。
// 説明
UWP アプリから、アクセントカラーを取得してみます。
UISettings.GetColorValue
の関数を使い、取得できます。
// サンプルコード
var color = new UISettings().GetColorValue(UIColorType.Accent);
// 使ってみた
Xaml
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Rectangle x:Name="Light3" Height="100" ToolTipService.ToolTip="Light3" ></Rectangle> <Rectangle x:Name="Light2" Height="100" ToolTipService.ToolTip="Light2"></Rectangle> <Rectangle x:Name="Light1" Height="100" ToolTipService.ToolTip="Light1"></Rectangle> <Rectangle x:Name="AccentColor" Height="100" ToolTipService.ToolTip="AccentColor"></Rectangle> <Rectangle x:Name="Dark1" Height="100" ToolTipService.ToolTip="Dark1"></Rectangle> <Rectangle x:Name="Dark2" Height="100" ToolTipService.ToolTip="Dark2"></Rectangle> <Rectangle x:Name="Dark3" Height="100" ToolTipService.ToolTip="Dark3"></Rectangle> </StackPanel>
CSharp
Light3.Fill = new SolidColorBrush(new UISettings().GetColorValue(UIColorType.AccentLight3)); Light2.Fill = new SolidColorBrush(new UISettings().GetColorValue(UIColorType.AccentLight2)); Light1.Fill = new SolidColorBrush(new UISettings().GetColorValue(UIColorType.AccentLight1)); AccentColor.Fill = new SolidColorBrush(new UISettings().GetColorValue(UIColorType.Accent)); Dark1.Fill = new SolidColorBrush(new UISettings().GetColorValue(UIColorType.AccentDark1)); Dark2.Fill = new SolidColorBrush(new UISettings().GetColorValue(UIColorType.AccentDark2)); Dark3.Fill = new SolidColorBrush(new UISettings().GetColorValue(UIColorType.AccentDark3));
// 実際に動かしたスクショ