Add round corner support for Wox.

This commit is contained in:
qianlifeng 2014-03-15 00:17:37 +08:00
parent 1b382e4391
commit ea4e25ea28
10 changed files with 195 additions and 146 deletions

View file

@ -9,17 +9,21 @@
WindowStyle="None"
WindowStartupLocation="Manual"
ShowInTaskbar="False"
AllowsTransparency="True"
Background="{x:Null}"
Style="{DynamicResource WindowStyle}"
Icon="Images\app.png"
>
<Grid Style="{DynamicResource GridStyle}" x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition ></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBox Style="{DynamicResource QueryBoxStyle}" Grid.Row="0" x:Name="tbQuery" PreviewKeyDown="TbQuery_OnPreviewKeyDown" TextChanged="TextBoxBase_OnTextChanged" />
<Line Style="{DynamicResource PendingLineStyle}" x:Name="progressBar" Y1="0" Y2="0" X2="100" Grid.Row="1" Height="2" StrokeThickness="1"></Line>
<wox:ResultPanel x:Name="resultCtrl" Grid.Row="2"/>
</Grid>
<Border Style="{DynamicResource WindowBorderStyle}">
<Grid x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition ></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBox Style="{DynamicResource QueryBoxStyle}" Grid.Row="0" x:Name="tbQuery" PreviewKeyDown="TbQuery_OnPreviewKeyDown" TextChanged="TextBoxBase_OnTextChanged" />
<Line Style="{DynamicResource PendingLineStyle}" x:Name="progressBar" Y1="0" Y2="0" X2="100" Grid.Row="1" Height="2" StrokeThickness="1"></Line>
<wox:ResultPanel x:Name="resultCtrl" Grid.Row="2"/>
</Grid>
</Border>
</Window>

View file

@ -53,7 +53,6 @@ namespace Wox
resultCtrl.OnMouseClickItem += AcceptSelect;
ThreadPool.SetMaxThreads(30, 10);
InitProgressbarAnimation();
try
{
SetTheme(CommonStorage.Instance.UserSetting.Theme);
@ -74,6 +73,8 @@ namespace Wox
Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3;
Plugins.Init();
InitProgressbarAnimation();
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
@ -140,8 +141,8 @@ namespace Wox
private void InitProgressbarAnimation()
{
var da = new DoubleAnimation(progressBar.X2, Width + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
var da1 = new DoubleAnimation(progressBar.X1, Width, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
var da = new DoubleAnimation(progressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
var da1 = new DoubleAnimation(progressBar.X1, ActualWidth, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)"));
Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)"));
progressBarStoryboard.Children.Add(da);
@ -366,7 +367,7 @@ namespace Wox
{
var dict = new ResourceDictionary
{
Source = new Uri("pack://application:,,,/Themes/" + themeName + ".xaml")
Source = new Uri(Path.Combine(Directory.GetCurrentDirectory(),"Themes\\"+themeName+".xaml") , UriKind.Absolute)
};
Application.Current.Resources.MergedDictionaries.Clear();

View file

@ -11,12 +11,12 @@
</UserControl.Resources>
<Grid x:Name="gridContainer">
<ListBox x:Name="lbResults" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource listboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling">
<ListBox x:Name="lbResults" PreviewMouseDown="LbResults_OnPreviewMouseDown" Style="{DynamicResource BaseListboxStyle}" SelectionChanged ="lbResults_SelectionChanged" Focusable="False" KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling">
<ListBox.Resources>
<!--SelectedItem with focus-->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ResultItemHighlightBackgroundColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/>
<!--SelectedItem without focus-->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{DynamicResource ResultItemHighlightBackgroundColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{DynamicResource ItemSelectedBackgroundColor}"/>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>

View file

@ -67,7 +67,7 @@ namespace Wox
private List<string> LoadAvailableThemes()
{
string themePath = Directory.GetCurrentDirectory() + "\\Themes\\";
return Directory.GetFiles(themePath).Where(filePath => filePath.EndsWith(".xaml")).ToList();
return Directory.GetFiles(themePath).Where(filePath => filePath.EndsWith(".xaml") && !filePath.EndsWith("Default.xaml")).ToList();
}
private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)

40
Wox/Themes/Dark.xaml Normal file
View file

@ -0,0 +1,40 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Default.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
</Style>
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="CornerRadius" Value="5" />
</Style>
<Style x:Key="WindowStyle" BasedOn="{StaticResource BaseWindowStyle}" TargetType="{x:Type Window}">
</Style>
<Style x:Key="PendingLineStyle" BasedOn="{StaticResource BasePendingLineStyle}" TargetType="{x:Type Line}">
</Style>
<!-- Item Style -->
<Style x:Key="ItemTitleStyle" BasedOn="{StaticResource BaseItemTitleStyle}" TargetType="{x:Type TextBlock}">
</Style>
<Style x:Key="ItemSubTitleStyle" BasedOn="{StaticResource BaseItemSubTitleStyle}" TargetType="{x:Type TextBlock}" >
</Style>
<Style x:Key="ItemTitleSelectedStyle" BasedOn="{StaticResource BaseItemTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
</Style>
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
</Style>
<Color x:Key="ItemSelectedBackgroundColor">#4F6180</Color>
<!-- button style in the middle of the scrollbar -->
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
</Style>
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}">
</Style>
</ResourceDictionary>

View file

@ -1,7 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<Style x:Key="QueryBoxStyle" TargetType="{x:Type TextBox}">
<Style x:Key="BaseQueryBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="25" />
<Setter Property="FontWeight" Value="Medium" />
@ -12,38 +12,42 @@
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
</Style>
<Style x:Key="WindowStyle" TargetType="{x:Type Window}">
<Style x:Key="BaseWindowBorderStyle" TargetType="{x:Type Border}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="#616161" />
<Setter Property="CornerRadius" Value="10" />
<Setter Property="Background" Value="#424242"></Setter>
<Setter Property="Padding" Value="8 10 8 8" />
</Style>
<Style x:Key="BaseWindowStyle" TargetType="{x:Type Window}">
<Setter Property="Height" Value="80" />
<Setter Property="Width" Value="500" />
<Setter Property="Background" Value="#424242" />
</Style>
<Style x:Key="GridStyle" TargetType="{x:Type Grid}">
<Setter Property="Margin" Value="8 10 8 8" />
</Style>
<Style x:Key="PendingLineStyle" TargetType="{x:Type Line}">
<Style x:Key="BasePendingLineStyle" TargetType="{x:Type Line}">
<Setter Property="Stroke" Value="Blue" />
</Style>
<!-- Item Style -->
<Style x:Key="ItemTitleStyle" TargetType="{x:Type TextBlock}">
<Style x:Key="BaseItemTitleStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#FFFFF8" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Medium" />
</Style>
<Style x:Key="ItemSubTitleStyle" TargetType="{x:Type TextBlock}" >
<Style x:Key="BaseItemSubTitleStyle" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="#D9D9D4" />
</Style>
<Style x:Key="ItemTitleSelectedStyle" TargetType="{x:Type TextBlock}" >
<Style x:Key="BaseItemTitleSelectedStyle" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="#FFFFF8" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Medium" />
</Style>
<Style x:Key="ItemSubTitleSelectedStyle" TargetType="{x:Type TextBlock}" >
<Style x:Key="BaseItemSubTitleSelectedStyle" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="#D9D9D4" />
</Style>
<Color x:Key="ResultItemHighlightBackgroundColor">#4F6180</Color>
<Style x:Key="listboxStyle" TargetType="{x:Type ListBox}">
<Style x:Key="BaseListboxStyle" TargetType="{x:Type ListBox}">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
@ -96,7 +100,7 @@
</ControlTemplate>
<!-- button style in the middle of the scrollbar -->
<Style x:Key="ThumbStyle" TargetType="{x:Type Thumb}">
<Style x:Key="BaseThumbStyle" TargetType="{x:Type Thumb}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
@ -110,7 +114,7 @@
</Setter>
</Style>
<Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Style x:Key="BaseScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
<Setter Property="Stylus.IsFlicksEnabled" Value="false" />
<!-- must set min width -->

View file

@ -1,106 +1,43 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="QueryBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="25"/>
<Setter Property="FontWeight" Value="Medium"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="Height" Value="46"/>
<Setter Property="Background" Value="#DEDEDE"/>
<Setter Property="Foreground" Value="#2E2F30" />
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
</Style>
<Style x:Key="WindowStyle" TargetType="{x:Type Window}" >
<Setter Property="Background" Value="#EDEDED"></Setter>
<Setter Property="Width" Value="520"></Setter>
<Setter Property="Height" Value="80"></Setter>
</Style>
<Style x:Key="GridStyle" TargetType="{x:Type Grid}" >
<Setter Property="Margin" Value="8 10 8 8"></Setter>
</Style>
<Style x:Key="PendingLineStyle" TargetType="{x:Type Line}" >
<Setter Property="Stroke" Value="Blue"></Setter>
</Style>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="#EBEBEB"/>
<Setter Property="Foreground" Value="#000000" />
</Style>
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
<Setter Property="Background" Value="#FFFFFF"></Setter>
<Setter Property="CornerRadius" Value="8" />
<Setter Property="BorderBrush" Value="#AAAAAA" />
<Setter Property="BorderThickness" Value="10" />
</Style>
<Style x:Key="WindowStyle" TargetType="{x:Type Window}" BasedOn="{StaticResource BaseWindowStyle}" >
<Setter Property="Width" Value="520"></Setter>
</Style>
<Style x:Key="PendingLineStyle" BasedOn="{StaticResource BasePendingLineStyle}" TargetType="{x:Type Line}" >
</Style>
<!-- Item Style -->
<Style x:Key="ItemTitleStyle" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="#141411"></Setter>
<Setter Property="FontSize" Value="16"></Setter>
<Setter Property="FontWeight" Value="Medium"></Setter>
<Style x:Key="ItemTitleStyle" BasedOn="{StaticResource BaseItemTitleStyle}" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="#000000"></Setter>
</Style>
<Style x:Key="ItemSubTitleStyle" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="#B3B2B0"></Setter>
<Style x:Key="ItemSubTitleStyle" BasedOn="{StaticResource BaseItemSubTitleStyle}" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="#000000"></Setter>
</Style>
<Style x:Key="ItemTitleSelectedStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#F6F6FF" />
<Setter Property="FontSize" Value="16"></Setter>
<Setter Property="FontWeight" Value="Medium"></Setter>
</Style>
<Style x:Key="ItemSubTitleSelectedStyle" TargetType="{x:Type TextBlock}">
<Style x:Key="ItemTitleSelectedStyle" BasedOn="{StaticResource BaseItemTitleSelectedStyle}" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#F6F6FF" />
</Style>
<Color x:Key="ResultItemHighlightBackgroundColor">#543BFD</Color>
<Style x:Key="listboxStyle" TargetType="{x:Type ListBox}">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<ScrollViewer Focusable="false" Template="{DynamicResource ScrollViewerControlTemplate}">
<VirtualizingStackPanel IsItemsHost="True" />
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#F6F6FF" />
</Style>
<!-- ScrollViewer Style -->
<ControlTemplate x:Key="ScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}">
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!--content in the left of ScrollViewer, just default-->
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
CanContentScroll="{TemplateBinding CanContentScroll}"
CanHorizontallyScroll="False"
CanVerticallyScroll="False"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
Grid.Column="0"
Margin="{TemplateBinding Padding}"
Grid.Row="0" />
<!--Scrollbar in thr rigth of ScrollViewer-->
<ScrollBar x:Name="PART_VerticalScrollBar"
AutomationProperties.AutomationId="VerticalScrollBar"
Cursor="Arrow"
Grid.Column="1"
Margin="2 0 0 0"
Maximum="{TemplateBinding ScrollableHeight}"
Minimum="0"
Grid.Row="0"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
ViewportSize="{TemplateBinding ViewportHeight}"
Style="{DynamicResource ScrollBarStyle}" />
</Grid>
</ControlTemplate>
<Color x:Key="ItemSelectedBackgroundColor">#3875D7</Color>
<!-- button style in the middle of the scrollbar -->
<Style x:Key="ThumbStyle" TargetType="{x:Type Thumb}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Focusable" Value="false"/>
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
@ -110,25 +47,6 @@
</Setter>
</Style>
<Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
<Setter Property="Stylus.IsFlicksEnabled" Value="false" />
<!-- must set min width -->
<Setter Property="MinWidth" Value="0"/>
<Setter Property="Width" Value="3.5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<DockPanel>
<Track x:Name="PART_Track" IsDirectionReversed="true" DockPanel.Dock="Right">
<Track.Thumb>
<Thumb Style="{DynamicResource ThumbStyle}"/>
</Track.Thumb>
</Track>
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}">
</Style>
</ResourceDictionary>

View file

@ -0,0 +1,52 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="{%searchFieldBackgroundColor%}"/>
<Setter Property="Foreground" Value="{%searchFieldTextColor%}" />
</Style>
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
<Setter Property="Background" Value="{%backgroundColor%}"></Setter>
<Setter Property="CornerRadius" Value="8" />
<Setter Property="BorderBrush" Value="{%borderColor%}" />
<Setter Property="BorderThickness" Value="10" />
</Style>
<Style x:Key="WindowStyle" TargetType="{x:Type Window}" BasedOn="{StaticResource BaseWindowStyle}" >
<Setter Property="Width" Value="520"></Setter>
</Style>
<Style x:Key="PendingLineStyle" BasedOn="{StaticResource BasePendingLineStyle}" TargetType="{x:Type Line}" >
</Style>
<!-- Item Style -->
<Style x:Key="ItemTitleStyle" BasedOn="{StaticResource BaseItemTitleStyle}" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="{%resultTextColor%}"></Setter>
</Style>
<Style x:Key="ItemSubTitleStyle" BasedOn="{StaticResource BaseItemSubTitleStyle}" TargetType="{x:Type TextBlock}" >
<Setter Property="Foreground" Value="{%resultSubtextColor%}"></Setter>
</Style>
<Style x:Key="ItemTitleSelectedStyle" BasedOn="{StaticResource BaseItemTitleSelectedStyle}" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{%selectedResultForeground%}" />
</Style>
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{%selectedSubtextForeground%}" />
</Style>
<Color x:Key="ItemSelectedBackgroundColor">{%selectedResultBackgroundColor%}</Color>
<!-- button style in the middle of the scrollbar -->
<Style x:Key="ThumbStyle" BasedOn="{StaticResource BaseThumbStyle}" TargetType="{x:Type Thumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border CornerRadius="2" DockPanel.Dock="Right" Background="{%scrollbarColor%}" BorderBrush="Transparent" BorderThickness="0" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}">
</Style>
</ResourceDictionary>

View file

@ -0,0 +1,26 @@
import os,plistlib
def convert(path,templatePath):
pl = plistlib.readPlist(path)
with open(templatePath, 'r') as content_file:
template = content_file.read()
for key in pl:
if "rgba" in pl[key]:
template = template.replace("{%"+key+"%}",tohex(pl[key].replace("rgba","rgb")))
f = open(path.replace(".alfredtheme",".xaml"),'w')
f.write(template)
f.close()
def tohex(string):
string = string[4:]
split = string.split(",")
split[2] = ''.join(split[2].split(")")[0])
r = int(split[0])
g = int(split[1])
b = int(split[2])
tu = (r, g, b)
return '#%02x%02x%02x' % tu
#print tohex("rgb(255,255,255,0.50)")
print convert("Night.alfredtheme","Light.xaml")

View file

@ -188,10 +188,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Light.xaml">
<None Include="Themes\Dark.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</None>
<None Include="Themes\Light.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</None>
<Page Include="Themes\Default.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -325,4 +329,4 @@ xcopy /Y $(ProjectDir)Themes\*.* $(TargetDir)Themes\</PostBuildEvent>
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>