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

@@ -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")