|
| 1 | +<?xml version="1.0" encoding="utf-8" ?> |
| 2 | +<Page x:Class="DevWinUIGallery.Views.ColorAnalyzerPage" |
| 3 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 4 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:dev="using:DevWinUI" |
| 7 | + xmlns:local="using:DevWinUIGallery" |
| 8 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 9 | + mc:Ignorable="d"> |
| 10 | + <Page.Resources> |
| 11 | + <dev:ColorAnalyzer x:Name="ColorAnalyzerSample" |
| 12 | + Source="{x:Bind ImageSample}"> |
| 13 | + <dev:AccentColorAnalyzer x:Name="AccentColorAnalyzerSample" |
| 14 | + MinColorCount="3" /> |
| 15 | + <dev:BaseColorAnalyzer x:Name="BaseColorAnalyzerSample" |
| 16 | + MinColorCount="3" /> |
| 17 | + <dev:ColorWeightAnalyzer x:Name="ColorWeightAnalyzerSample" |
| 18 | + MinColorCount="3" /> |
| 19 | + </dev:ColorAnalyzer> |
| 20 | + </Page.Resources> |
| 21 | + <ScrollViewer> |
| 22 | + <StackPanel Margin="10" dev:PanelAttach.ChildrenTransitions="Default" Spacing="10"> |
| 23 | + <local:ControlExample DocPage="colorAnalyzer" |
| 24 | + DocType="Core" |
| 25 | + XamlSource="Features/ColorAnalyzer_xaml.txt"> |
| 26 | + <local:ControlExample.Pane> |
| 27 | + <StackPanel Spacing="10"> |
| 28 | + <Button x:Name="BtnChange" |
| 29 | + MinWidth="200" |
| 30 | + HorizontalAlignment="Center" |
| 31 | + Click="BtnChange_Click" |
| 32 | + Content="Change Image" /> |
| 33 | + <Image x:Name="ImageSample" |
| 34 | + Width="200" |
| 35 | + Height="200" |
| 36 | + HorizontalAlignment="Center" |
| 37 | + VerticalAlignment="Top" |
| 38 | + ImageOpened="ImageSample_ImageOpened" |
| 39 | + Source="ms-appx:///Assets/Carousel/5.jpg" |
| 40 | + Stretch="Uniform" /> |
| 41 | + </StackPanel> |
| 42 | + </local:ControlExample.Pane> |
| 43 | + <StackPanel Spacing="10"> |
| 44 | + <Grid Grid.Column="1" MaxWidth="400" MaxHeight="250" Margin="20" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
| 45 | + <Grid.ColumnDefinitions> |
| 46 | + <ColumnDefinition /> |
| 47 | + <ColumnDefinition /> |
| 48 | + </Grid.ColumnDefinitions> |
| 49 | + <Grid.RowDefinitions> |
| 50 | + <RowDefinition /> |
| 51 | + <RowDefinition Height="0.6*" /> |
| 52 | + <RowDefinition Height="0.4*" /> |
| 53 | + </Grid.RowDefinitions> |
| 54 | + |
| 55 | + <!-- Primary Accent Color --> |
| 56 | + <Border Grid.ColumnSpan="2" |
| 57 | + Margin="4" |
| 58 | + Padding="2"> |
| 59 | + <Border.Background> |
| 60 | + <SolidColorBrush Color="{x:Bind AccentColorAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" /> |
| 61 | + </Border.Background> |
| 62 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind AccentColorAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" |
| 63 | + Text="Primary Accent" /> |
| 64 | + </Border> |
| 65 | + |
| 66 | + <!-- Secondary Accent Color --> |
| 67 | + <Border Grid.Row="1" |
| 68 | + Margin="4" |
| 69 | + Padding="2"> |
| 70 | + <Border.Background> |
| 71 | + <SolidColorBrush Color="{x:Bind AccentColorAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" /> |
| 72 | + </Border.Background> |
| 73 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind AccentColorAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" |
| 74 | + Text="Secondary Accent" /> |
| 75 | + </Border> |
| 76 | + |
| 77 | + <!-- Tertiary Accent Color --> |
| 78 | + <Border Grid.Row="1" |
| 79 | + Grid.Column="1" |
| 80 | + Margin="4" |
| 81 | + Padding="2"> |
| 82 | + <Border.Background> |
| 83 | + <SolidColorBrush Color="{x:Bind AccentColorAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" /> |
| 84 | + </Border.Background> |
| 85 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind AccentColorAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" |
| 86 | + Text="Tertiary Accent" /> |
| 87 | + </Border> |
| 88 | + |
| 89 | + <!-- Accent Colors Gradient --> |
| 90 | + <Rectangle Grid.Row="3" |
| 91 | + Grid.ColumnSpan="2" |
| 92 | + Margin="4"> |
| 93 | + <Rectangle.Fill> |
| 94 | + <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5"> |
| 95 | + <GradientStopCollection> |
| 96 | + <GradientStop Offset="0" Color="{x:Bind AccentColorAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" /> |
| 97 | + <GradientStop Offset="0.6" Color="{x:Bind AccentColorAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" /> |
| 98 | + <GradientStop Offset="1" Color="{x:Bind AccentColorAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" /> |
| 99 | + </GradientStopCollection> |
| 100 | + </LinearGradientBrush> |
| 101 | + </Rectangle.Fill> |
| 102 | + </Rectangle> |
| 103 | + </Grid> |
| 104 | + <NavigationViewItemSeparator /> |
| 105 | + <Grid Grid.Column="1" MaxWidth="400" MaxHeight="250" Margin="20" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
| 106 | + <Grid.ColumnDefinitions> |
| 107 | + <ColumnDefinition /> |
| 108 | + <ColumnDefinition /> |
| 109 | + </Grid.ColumnDefinitions> |
| 110 | + <Grid.RowDefinitions> |
| 111 | + <RowDefinition /> |
| 112 | + <RowDefinition Height="0.6*" /> |
| 113 | + <RowDefinition Height="0.4*" /> |
| 114 | + </Grid.RowDefinitions> |
| 115 | + |
| 116 | + <!-- Primary Base Color --> |
| 117 | + <Border Grid.ColumnSpan="2" |
| 118 | + Margin="4" |
| 119 | + Padding="2"> |
| 120 | + <Border.Background> |
| 121 | + <SolidColorBrush Color="{x:Bind BaseColorAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" /> |
| 122 | + </Border.Background> |
| 123 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind BaseColorAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" |
| 124 | + Text="Primary Base" /> |
| 125 | + </Border> |
| 126 | + |
| 127 | + <!-- Secondary Base Color --> |
| 128 | + <Border Grid.Row="1" |
| 129 | + Margin="4" |
| 130 | + Padding="2"> |
| 131 | + <Border.Background> |
| 132 | + <SolidColorBrush Color="{x:Bind BaseColorAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" /> |
| 133 | + </Border.Background> |
| 134 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind BaseColorAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" |
| 135 | + Text="Secondary Base" /> |
| 136 | + </Border> |
| 137 | + |
| 138 | + <!-- Tertiary Base Color --> |
| 139 | + <Border Grid.Row="1" |
| 140 | + Grid.Column="1" |
| 141 | + Margin="4" |
| 142 | + Padding="2"> |
| 143 | + <Border.Background> |
| 144 | + <SolidColorBrush Color="{x:Bind BaseColorAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" /> |
| 145 | + </Border.Background> |
| 146 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind BaseColorAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" |
| 147 | + Text="Tertiary Base" /> |
| 148 | + </Border> |
| 149 | + |
| 150 | + <!-- Base Colors Gradient --> |
| 151 | + <Rectangle Grid.Row="3" |
| 152 | + Grid.ColumnSpan="2" |
| 153 | + Margin="4"> |
| 154 | + <Rectangle.Fill> |
| 155 | + <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5"> |
| 156 | + <GradientStopCollection> |
| 157 | + <GradientStop Offset="0" Color="{x:Bind BaseColorAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" /> |
| 158 | + <GradientStop Offset="0.6" Color="{x:Bind BaseColorAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" /> |
| 159 | + <GradientStop Offset="1" Color="{x:Bind BaseColorAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" /> |
| 160 | + </GradientStopCollection> |
| 161 | + </LinearGradientBrush> |
| 162 | + </Rectangle.Fill> |
| 163 | + </Rectangle> |
| 164 | + </Grid> |
| 165 | + <NavigationViewItemSeparator /> |
| 166 | + <Grid Grid.Column="1" MaxWidth="400" MaxHeight="250" Margin="20" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
| 167 | + <Grid.ColumnDefinitions> |
| 168 | + <ColumnDefinition /> |
| 169 | + <ColumnDefinition /> |
| 170 | + </Grid.ColumnDefinitions> |
| 171 | + <Grid.RowDefinitions> |
| 172 | + <RowDefinition /> |
| 173 | + <RowDefinition Height="0.6*" /> |
| 174 | + <RowDefinition Height="0.4*" /> |
| 175 | + </Grid.RowDefinitions> |
| 176 | + |
| 177 | + <!-- Primary Weight Color --> |
| 178 | + <Border Grid.ColumnSpan="2" |
| 179 | + Margin="4" |
| 180 | + Padding="2"> |
| 181 | + <Border.Background> |
| 182 | + <SolidColorBrush Color="{x:Bind ColorWeightAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" /> |
| 183 | + </Border.Background> |
| 184 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind ColorWeightAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" |
| 185 | + Text="Primary Base" /> |
| 186 | + </Border> |
| 187 | + |
| 188 | + <!-- Secondary Weight Color --> |
| 189 | + <Border Grid.Row="1" |
| 190 | + Margin="4" |
| 191 | + Padding="2"> |
| 192 | + <Border.Background> |
| 193 | + <SolidColorBrush Color="{x:Bind ColorWeightAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" /> |
| 194 | + </Border.Background> |
| 195 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind ColorWeightAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" |
| 196 | + Text="Secondary Base" /> |
| 197 | + </Border> |
| 198 | + |
| 199 | + <!-- Tertiary Weight Color --> |
| 200 | + <Border Grid.Row="1" |
| 201 | + Grid.Column="1" |
| 202 | + Margin="4" |
| 203 | + Padding="2"> |
| 204 | + <Border.Background> |
| 205 | + <SolidColorBrush Color="{x:Bind ColorWeightAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" /> |
| 206 | + </Border.Background> |
| 207 | + <TextBlock dev:ContrastAnalyzer.Opponent="{x:Bind ColorWeightAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" |
| 208 | + Text="Tertiary Base" /> |
| 209 | + </Border> |
| 210 | + |
| 211 | + <!-- Weight Colors Gradient --> |
| 212 | + <Rectangle Grid.Row="3" |
| 213 | + Grid.ColumnSpan="2" |
| 214 | + Margin="4"> |
| 215 | + <Rectangle.Fill> |
| 216 | + <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5"> |
| 217 | + <GradientStopCollection> |
| 218 | + <GradientStop Offset="0" Color="{x:Bind ColorWeightAnalyzerSample.SelectedColors[0], FallbackValue=Transparent, Mode=OneWay}" /> |
| 219 | + <GradientStop Offset="0.6" Color="{x:Bind ColorWeightAnalyzerSample.SelectedColors[1], FallbackValue=Transparent, Mode=OneWay}" /> |
| 220 | + <GradientStop Offset="1" Color="{x:Bind ColorWeightAnalyzerSample.SelectedColors[2], FallbackValue=Transparent, Mode=OneWay}" /> |
| 221 | + </GradientStopCollection> |
| 222 | + </LinearGradientBrush> |
| 223 | + </Rectangle.Fill> |
| 224 | + </Rectangle> |
| 225 | + </Grid> |
| 226 | + |
| 227 | + </StackPanel> |
| 228 | + </local:ControlExample> |
| 229 | + </StackPanel> |
| 230 | + </ScrollViewer> |
| 231 | + |
| 232 | +</Page> |
0 commit comments