読者です 読者をやめる 読者になる 読者になる

UWPでSystemControlHighlightAccentBrushなど欲しい配色をまとめていただくサンプル

メモ

UWPでApp.xamlに貼りつけたいSystemControlHighlightAccentBrushなど、欲しい配色をシステムからまとめていただくサンプルです。

TextBox

TextBox にコピーするソース

<SolidColorBrush x:Key="SystemControlBackgroundAccentBrush" Color="{SystemControlBackgroundAccentBrush}" />
<SolidColorBrush x:Key="SystemControlDisabledAccentBrush" Color="{SystemControlDisabledAccentBrush}" />
<SolidColorBrush x:Key="SystemControlForegroundAccentBrush" Color="{SystemControlForegroundAccentBrush}" />
<SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="{SystemControlHighlightAccentBrush}" />
<SolidColorBrush x:Key="SystemControlHighlightAltAccentBrush" Color="{SystemControlHighlightAltAccentBrush}" />
<SolidColorBrush x:Key="SystemControlHighlightAltListAccentHighBrush" Color="{SystemControlHighlightAltListAccentHighBrush}" />
<SolidColorBrush x:Key="SystemControlHighlightAltListAccentLowBrush" Color="{SystemControlHighlightAltListAccentLowBrush}" />
<SolidColorBrush x:Key="SystemControlHighlightAltListAccentMediumBrush" Color="{SystemControlHighlightAltListAccentMediumBrush}" />
<SolidColorBrush x:Key="SystemControlHighlightListAccentHighBrush" Color="{SystemControlHighlightListAccentHighBrush}" />
<SolidColorBrush x:Key="SystemControlHighlightListAccentLowBrush" Color="{SystemControlHighlightListAccentLowBrush}" />
<SolidColorBrush x:Key="SystemControlHighlightListAccentMediumBrush" Color="{SystemControlHighlightListAccentMediumBrush}" />

TextBoxに貼りつける場合はF2キーを押して記入する

<TextBox x:Name="TextBox" AcceptsReturn="True" Text="&lt;SolidColorBrush x:Key=&quot;SystemControlBackgroundAccentBrush&quot; Color=&quot;{SystemControlBackgroundAccentBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlDisabledAccentBrush&quot; Color=&quot;{SystemControlDisabledAccentBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlForegroundAccentBrush&quot; Color=&quot;{SystemControlForegroundAccentBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlHighlightAccentBrush&quot; Color=&quot;{SystemControlHighlightAccentBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlHighlightAltAccentBrush&quot; Color=&quot;{SystemControlHighlightAltAccentBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlHighlightAltListAccentHighBrush&quot; Color=&quot;{SystemControlHighlightAltListAccentHighBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlHighlightAltListAccentLowBrush&quot; Color=&quot;{SystemControlHighlightAltListAccentLowBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlHighlightAltListAccentMediumBrush&quot; Color=&quot;{SystemControlHighlightAltListAccentMediumBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlHighlightListAccentHighBrush&quot; Color=&quot;{SystemControlHighlightListAccentHighBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlHighlightListAccentLowBrush&quot; Color=&quot;{SystemControlHighlightListAccentLowBrush}&quot; /&gt;&#xD;&#xA;&lt;SolidColorBrush x:Key=&quot;SystemControlHighlightListAccentMediumBrush&quot; Color=&quot;{SystemControlHighlightListAccentMediumBrush}&quot; /&gt;&#xD;&#xA;&#xD;&#xA;" />

ソースコード

    Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
        TextBox.Text = TextBox.Text.
            Replace("{SystemControlBackgroundAccentBrush}", CType(App.Current.Resources("SystemControlBackgroundAccentBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlDisabledAccentBrush}", CType(App.Current.Resources("SystemControlDisabledAccentBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlForegroundAccentBrush}", CType(App.Current.Resources("SystemControlForegroundAccentBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlHighlightAccentBrush}", CType(App.Current.Resources("SystemControlHighlightAccentBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlHighlightAltAccentBrush}", CType(App.Current.Resources("SystemControlHighlightAltAccentBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlHighlightAltListAccentHighBrush}", CType(App.Current.Resources("SystemControlHighlightAltListAccentHighBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlHighlightAltListAccentLowBrush}", CType(App.Current.Resources("SystemControlHighlightAltListAccentLowBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlHighlightAltListAccentMediumBrush}", CType(App.Current.Resources("SystemControlHighlightAltListAccentMediumBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlHighlightListAccentHighBrush}", CType(App.Current.Resources("SystemControlHighlightListAccentHighBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlHighlightListAccentLowBrush}", CType(App.Current.Resources("SystemControlHighlightListAccentLowBrush"), SolidColorBrush).Color.ToString).
            Replace("{SystemControlHighlightListAccentMediumBrush}", CType(App.Current.Resources("SystemControlHighlightListAccentMediumBrush"), SolidColorBrush).Color.ToString)

    End Sub

取得結果

f:id:morokoshidog:20161010160434p:plainf:id:morokoshidog:20161010160448p:plain

<SolidColorBrush x:Key="SystemControlBackgroundAccentBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlDisabledAccentBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlForegroundAccentBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlHighlightAltAccentBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlHighlightAltListAccentHighBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlHighlightAltListAccentLowBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlHighlightAltListAccentMediumBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlHighlightListAccentHighBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlHighlightListAccentLowBrush" Color="#FF0099BC" />
<SolidColorBrush x:Key="SystemControlHighlightListAccentMediumBrush" Color="#FF0099BC" />