Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

简单加了一个暗色模式 #81

Merged
18 commits merged into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions PixivFSUWP/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
xmlns:viewmodels="using:PixivFSUWP.ViewModels"
xmlns:local="using:PixivFSUWP"
xmlns:converters="using:PixivFSUWP.Converters"
RequestedTheme="Light">
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark" Source="/Themes/Dark.xaml" />
<ResourceDictionary x:Key="Default" Source="/Themes/Light.xaml" />
</ResourceDictionary.ThemeDictionaries>
<converters:MultiPageVisibilityConverter x:Name="MultiPageVisibilityConverter"/>
<converters:BookmarkHeartVisibilityConverter x:Name="BookmarkHeartVisibilityConverter"/>
<AcrylicBrush x:Name="PageBackGround" BackgroundSource="HostBackdrop" TintColor="White" TintOpacity="0.5" FallbackColor="White"/>
<AcrylicBrush x:Name="PageBackGround" BackgroundSource="HostBackdrop" TintColor="{ThemeResource SystemAltHighColor}" TintOpacity="{ThemeResource PageBackGroundTintOpacity}" FallbackColor="{ThemeResource SystemAltHighColor}"/>
<ControlTemplate x:Name="ScrollViewerScrollBarlessTemplate" TargetType="ScrollViewer">
<Grid Background="{TemplateBinding Background}">
<ScrollContentPresenter x:Name="ScrollContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}"/>
Expand All @@ -25,7 +30,7 @@
<RowDefinition MaxHeight="50"/>
</Grid.RowDefinitions>
<Image Grid.RowSpan="2" Stretch="Uniform" Source="{Binding ImageSource}"/>
<Grid Grid.Row="1" Background="#88ffffff">
<Grid Grid.Row="1" Background="{ThemeResource SystemAltMediumColor}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
Expand Down Expand Up @@ -128,5 +133,6 @@
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
9 changes: 9 additions & 0 deletions PixivFSUWP/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ public App()
this.InitializeComponent();
this.Suspending += OnSuspending;
this.UnhandledException += App_UnhandledException;
switch (localSettings.Values["ColorTheme"])
{
case false:
Current.RequestedTheme = ApplicationTheme.Light;
break;
case true:
Current.RequestedTheme = ApplicationTheme.Dark;
break;
}
}

private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
Expand Down
Binary file added PixivFSUWP/Assets/PixivHeader_L.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PixivFSUWP/Assets/PixivText_L.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion PixivFSUWP/BigImage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<Grid x:Name="grdTip" HorizontalAlignment="Center" Grid.RowSpan="3"
VerticalAlignment="Bottom" Margin="20" Visibility="Collapsed" Opacity="0">
<Grid.Background>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="White" FallbackColor="White"/>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="{ThemeResource SystemAltHighColor}" FallbackColor="{ThemeResource SystemAltHighColor}"/>
</Grid.Background>
<TextBlock x:Name="txtTip" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
Expand Down
28 changes: 14 additions & 14 deletions PixivFSUWP/IllustDetailPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</ListView>
<StackPanel x:Name="stkAuthor" Margin="15,15,15,0" Height="70" Orientation="Horizontal">
<Button Style="{StaticResource ButtonRevealStyle}"
BorderThickness="1.5" Background="#99F3F3F3"
BorderThickness="1.5" Background="{ThemeResource SystemChromeLowColor}"
VerticalAlignment="Stretch" Click="Button_Click">
<Grid>
<Grid.ColumnDefinitions>
Expand All @@ -71,11 +71,11 @@
</Ellipse.Fill>
</Ellipse>
<TextBlock x:Name="txtAuthor" Margin="10,0" Grid.Column="1" FontSize="16" FontWeight="Bold" VerticalAlignment="Bottom"/>
<TextBlock x:Name="txtAuthorAccount" Margin="10,0" Grid.Row="1" Grid.Column="1" FontSize="14" Foreground="Gray" VerticalAlignment="Top"/>
<TextBlock x:Name="txtAuthorAccount" Margin="10,0" Grid.Row="1" Grid.Column="1" FontSize="14" Foreground="{ThemeResource SystemBaseMediumColor}" VerticalAlignment="Top"/>
</Grid>
</Button>
<Button Style="{StaticResource ButtonRevealStyle}" x:Name="btnPlay" Click="BtnPlay_Click"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70" Visibility="Collapsed">
<StackPanel Margin="5">
<FontIcon x:Name="iconPlay" FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -84,7 +84,7 @@
</StackPanel>
</Button>
<Button Style="{StaticResource ButtonRevealStyle}" x:Name="btnSaveGif" Click="BtnSaveGif_Click"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70" Visibility="Collapsed">
<StackPanel Margin="5">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -93,7 +93,7 @@
</StackPanel>
</Button>
<Button Style="{StaticResource ButtonRevealStyle}"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70">
<StackPanel Margin="5">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -109,7 +109,7 @@
</Button.Flyout>
</Button>
<ToggleButton x:Name="btnBookmark" Style="{StaticResource ToggleButtonRevealStyle}"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70" Click="BtnBookmark_Click">
<StackPanel Margin="5">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -118,7 +118,7 @@
</StackPanel>
</ToggleButton>
<ToggleButton x:Name="btnFollow" Style="{StaticResource ToggleButtonRevealStyle}"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70" Click="BtnFollow_Click">
<StackPanel Margin="5">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -131,20 +131,20 @@
<StackPanel Margin="15,15,15,0" Orientation="Horizontal">
<TextBlock x:Name="txtCommentTitle" Height="Auto" FontSize="20" FontWeight="Bold"/>
<ToggleButton x:Uid="NewComment" Height="Auto" Style="{StaticResource ToggleButtonRevealStyle}" Visibility="Collapsed"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" x:Name="btnNewComment" IsChecked="False"/>
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" x:Name="btnNewComment" IsChecked="False"/>
</StackPanel>
<StackPanel Margin="17,15,15,0" Width="600" Orientation="Vertical" HorizontalAlignment="Left" Visibility="{x:Bind Path=btnNewComment.IsChecked, Mode=OneWay}">
<TextBox TextWrapping="Wrap" AcceptsReturn="True" x:Name="txtComment" Height="80" PlaceholderText="编写评论..."/>
<StackPanel Margin="0 5 0 0" Orientation="Horizontal">
<Button x:Name="btnPublishComment" Click="btnPublishComment_Click">发表评论</Button>
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="12" Foreground="Gray">*请带着鼓励和建设性的态度发表评论</TextBlock>
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}">*请带着鼓励和建设性的态度发表评论</TextBlock>
</StackPanel>
</StackPanel>
<ListView x:Name="listComments" Margin="0,15" IncrementalLoadingTrigger="None" SelectionMode="None"
ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.HorizontalScrollMode="Disabled">
<ListView.ItemTemplate>
<DataTemplate x:DataType="viewmodels:CommentViewModel">
<Border Background="#99F3F3F3" Margin="5,10" BorderThickness="1.5">
<Border Background="{ThemeResource SystemChromeLowColor}" Margin="5,10" BorderThickness="1.5">
<Border.BorderBrush>
<RevealBorderBrush Color="Transparent" FallbackColor="LightGray"/>
</Border.BorderBrush>
Expand All @@ -170,10 +170,10 @@
</Ellipse.Fill>
</Ellipse>
<TextBlock Margin="5,0" Grid.Column="1" FontSize="14" FontWeight="Bold" VerticalAlignment="Bottom" Text="{Binding UserName}"/>
<TextBlock Margin="5,0" Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="Gray" VerticalAlignment="Top" Text="{Binding UserAccount}"/>
<TextBlock Margin="5,0" Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}" VerticalAlignment="Top" Text="{Binding UserAccount}"/>
</Grid>
<TextBlock Grid.Row="1" Margin="0,5,0,0" Text="{Binding Comment}" TextWrapping="WrapWholeWords"/>
<TextBlock Grid.Row="2" Margin="0,3,0,0" Text="{Binding DateTime}" FontSize="12" Foreground="Gray"/>
<TextBlock Grid.Row="2" Margin="0,3,0,0" Text="{Binding DateTime}" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}"/>
<ListView Grid.Row="3" Margin="10,5,0,0" Visibility="{Binding ChildrenComments,Converter={StaticResource ChildrenCommentVisibilityConverter}}"
ItemsSource="{Binding ChildrenComments}" SelectionMode="None"
ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.HorizontalScrollMode="Disabled">
Expand Down Expand Up @@ -201,10 +201,10 @@
</Ellipse.Fill>
</Ellipse>
<TextBlock Margin="5,0" Grid.Column="1" FontSize="14" FontWeight="Bold" VerticalAlignment="Bottom" Text="{Binding UserName}"/>
<TextBlock Margin="5,0" Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="Gray" VerticalAlignment="Top" Text="{Binding UserAccount}"/>
<TextBlock Margin="5,0" Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}" VerticalAlignment="Top" Text="{Binding UserAccount}"/>
</Grid>
<TextBlock Grid.Row="1" Text="{Binding Comment}" TextWrapping="WrapWholeWords"/>
<TextBlock Grid.Row="2" Margin="0,3,0,0" Text="{Binding DateTime}" FontSize="12" Foreground="Gray"/>
<TextBlock Grid.Row="2" Margin="0,3,0,0" Text="{Binding DateTime}" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}"/>
</Grid>
</Border>
</DataTemplate>
Expand Down
15 changes: 8 additions & 7 deletions PixivFSUWP/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="#25c6ff" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight1}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="BorderBrush">
Expand All @@ -43,7 +43,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="#15b6ef" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight2}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="BorderBrush">
Expand Down Expand Up @@ -79,15 +79,15 @@
<Grid Height="480" Width="400"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.Background>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.4" TintColor="White" FallbackColor="#99ffffff"/>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.4" TintColor="{ThemeResource SystemAltHighColor}" FallbackColor="{ThemeResource SystemAltMediumColor}"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Center" Margin="0,150,0,0" x:Uid="LoginBanner"/>
<Image Source="Assets/PixivText.png"/>
<Image Source="{ThemeResource PixivText}"/>
<StackPanel x:Name="stkTxts" Grid.Row="1" Margin="20,20,20,10" HorizontalAlignment="Stretch" VerticalAlignment="Center">
<TextBlock Margin="5" x:Uid="Username"/>
<TextBox x:Name="txtUserName" Margin="5"/>
Expand All @@ -96,7 +96,8 @@
</StackPanel>
<StackPanel x:Name="stkBtns" Margin="20,10,20,20" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="2">
<CheckBox x:Name="chkExperimental" x:Uid="ExperimentalConnection" Margin="5,3"/>
<Button x:Name="btnLogin" Click="BtnLogin_Click" Style="{StaticResource LoginButtonStyle}" Background="#25c6ff" Foreground="White" Margin="5,3" HorizontalAlignment="Stretch" x:Uid="Login"/>
<Button x:Name="btnLogin" Click="BtnLogin_Click" Margin="5,3" HorizontalAlignment="Stretch" x:Uid="Login"
Style="{StaticResource LoginButtonStyle}" Background="{ThemeResource SystemAccentColor}" Foreground="{ThemeResource ButtonForegroundThemeBrush}"/>
<Button x:Name="btnReg" Click="BtnReg_Click" Margin="5,3" HorizontalAlignment="Stretch" x:Uid="Register"/>
</StackPanel>
<Grid x:Name="grdLoading" Margin="20" Visibility="Collapsed" Grid.Row="1" Grid.RowSpan="2">
Expand All @@ -114,7 +115,7 @@
<Button Style="{StaticResource ButtonRevealStyleWithAcrylic}" HorizontalAlignment="Center"
BorderThickness="1.5" VerticalAlignment="Stretch" Click="Button_Click">
<Button.Background>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="White" FallbackColor="White"/>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="{ThemeResource SystemAltHighColor}" FallbackColor="{ThemeResource SystemAltHighColor}"/>
</Button.Background>
<Grid>
<Grid.ColumnDefinitions>
Expand All @@ -133,7 +134,7 @@
<Button Style="{StaticResource ButtonRevealStyleWithAcrylic}" HorizontalAlignment="Center"
BorderThickness="1.5" VerticalAlignment="Stretch" x:Name="btnReport" Click="btnReport_Click">
<Button.Background>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="White" FallbackColor="White"/>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="{ThemeResource SystemAltHighColor}" FallbackColor="{ThemeResource SystemAltHighColor}"/>
</Button.Background>
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="16" Glyph="&#xED15;"/>
Expand Down
4 changes: 2 additions & 2 deletions PixivFSUWP/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
SelectionChanged="NavControl_SelectionChanged"
IsSettingsVisible="False" BackRequested="NavControl_BackRequested">
<NavigationView.PaneHeader>
<Image Source="Assets/PixivHeader.png"/>
<Image Source="{ThemeResource PixivHeader}"/>
</NavigationView.PaneHeader>
<NavigationView.PaneFooter>
<StackPanel Orientation="Horizontal">
Expand Down Expand Up @@ -74,7 +74,7 @@
<Grid x:Name="grdTip" HorizontalAlignment="Center"
VerticalAlignment="Bottom" Margin="20" Visibility="Collapsed" Opacity="0">
<Grid.Background>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="White" FallbackColor="White"/>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="{ThemeResource SystemAltHighColor}" FallbackColor="{ThemeResource SystemAltHighColor}"/>
</Grid.Background>
<TextBlock x:Name="txtTip" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
Expand Down
Loading