|
25 | 25 | VerticalAlignment="Center"> |
26 | 26 | <Image x:Name="AccentedImage" |
27 | 27 | HorizontalAlignment="Center" |
28 | | - Source="/ColorAnalyzerExperiment.Samples/Assets/StockImages/Bloom.jpg" |
| 28 | + Source="/ColorAnalyzerExperiment.Samples/Assets/StockImages/Flowers.jpg" |
29 | 29 | Stretch="Uniform"> |
30 | 30 | <interactivity:Interaction.Behaviors> |
31 | 31 | <interactivity:EventTriggerBehavior EventName="ImageOpened"> |
|
62 | 62 | <Border.Background> |
63 | 63 | <SolidColorBrush Color="{x:Bind AccentAnalyzer.DominantColor, Mode=OneWay}" /> |
64 | 64 | </Border.Background> |
65 | | - <TextBlock Foreground="Black" |
| 65 | + <TextBlock helpers:ContrastHelper.Opponent="{x:Bind AccentAnalyzer.DominantColor, Mode=OneWay}" |
66 | 66 | Text="Dominant" /> |
67 | 67 | </Border> |
68 | 68 |
|
|
74 | 74 | <Border.Background> |
75 | 75 | <SolidColorBrush Color="{x:Bind AccentAnalyzer.BaseColor, Mode=OneWay}" /> |
76 | 76 | </Border.Background> |
77 | | - <TextBlock Foreground="Black" |
78 | | - Text="Base" /> |
| 77 | + <TextBlock Text="Base"> |
| 78 | + <TextBlock.Foreground> |
| 79 | + <!-- ConstrastHelper used to auto-adjust text Foreground against the dynamic background per WCAG --> |
| 80 | + <SolidColorBrush helpers:ContrastHelper.MinRatio="5" |
| 81 | + helpers:ContrastHelper.Opponent="{x:Bind AccentAnalyzer.BaseColor, Mode=OneWay}" |
| 82 | + Color="{x:Bind AccentAnalyzer.PrimaryAccentColor, Mode=OneWay}" /> |
| 83 | + </TextBlock.Foreground> |
| 84 | + </TextBlock> |
79 | 85 | </Border> |
80 | 86 |
|
81 | 87 | <!-- Primary --> |
|
86 | 92 | <Border.Background> |
87 | 93 | <SolidColorBrush Color="{x:Bind AccentAnalyzer.PrimaryAccentColor, Mode=OneWay}" /> |
88 | 94 | </Border.Background> |
89 | | - <TextBlock Foreground="Black" |
| 95 | + <TextBlock helpers:ContrastHelper.Opponent="{x:Bind AccentAnalyzer.PrimaryAccentColor, Mode=OneWay}" |
90 | 96 | Text="Primary" /> |
91 | 97 | </Border> |
92 | 98 | <!-- Secondary --> |
|
97 | 103 | <Border.Background> |
98 | 104 | <SolidColorBrush Color="{x:Bind AccentAnalyzer.SecondaryAccentColor, Mode=OneWay}" /> |
99 | 105 | </Border.Background> |
100 | | - <TextBlock Foreground="Black" |
| 106 | + <TextBlock helpers:ContrastHelper.Opponent="{x:Bind AccentAnalyzer.SecondaryAccentColor, Mode=OneWay}" |
101 | 107 | Text="Secondary" /> |
102 | 108 | </Border> |
103 | 109 | <!-- Tertiary --> |
|
108 | 114 | <Border.Background> |
109 | 115 | <SolidColorBrush Color="{x:Bind AccentAnalyzer.TertiaryAccentColor, Mode=OneWay}" /> |
110 | 116 | </Border.Background> |
111 | | - <TextBlock Foreground="Black" |
| 117 | + <TextBlock helpers:ContrastHelper.Opponent="{x:Bind AccentAnalyzer.TertiaryAccentColor, Mode=OneWay}" |
112 | 118 | Text="Tertiary" /> |
113 | 119 | </Border> |
114 | 120 |
|
|
0 commit comments