Allow Style.matrix to handle one or two values

This commit is contained in:
Zixaphir 2013-06-21 00:53:36 -07:00
parent cf6032084c
commit 453ec634c7
3 changed files with 44 additions and 37 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -131,23 +131,26 @@ Style =
matrix: (foreground, background) ->
fgHex = Style.colorToHex foreground
bgHex = Style.colorToHex background
[{
fg = {
r: parseInt(fgHex.substr(0, 2), 16) / 255
g: parseInt(fgHex.substr(2, 2), 16) / 255
b: parseInt(fgHex.substr(4, 2), 16) / 255
},
{
r: parseInt(bgHex.substr(0, 2), 16) / 255
g: parseInt(bgHex.substr(2, 2), 16) / 255
b: parseInt(bgHex.substr(4, 2), 16) / 255
}]
}
if background
bgHex = Style.colorToHex background
bg = {
r: parseInt(bgHex.substr(0, 2), 16) / 255
g: parseInt(bgHex.substr(2, 2), 16) / 255
b: parseInt(bgHex.substr(4, 2), 16) / 255
}
[fg, bg or fg]
filter: ([fg, bg]) ->
"#{bg.r} #{-fg.r} 0 0 #{fg.r} #{bg.g} #{-fg.g} 0 0 #{fg.g} #{bg.b} #{-fg.b} 0 0 #{fg.b}"
silhouette: ([fg, bg]) ->
silhouette: ([fg]) ->
"0 0 0 0 #{fg.r} 0 0 0 0 #{fg.g} 0 0 0 0 #{fg.b}"
layout: """<%= grunt.file.read('src/General/css/layout.css') %>"""
@ -179,7 +182,7 @@ Style =
Style.svg.innerHTML = """
<svg xmlns='http://www.w3.org/2000/svg' height=0><filter id='captcha-filter' color-interpolation-filters='sRGB'><feColorMatrix values='#{Style.filter Style.matrix theme["Text"], theme["Input Background"]} 0 0 0 1 0' /></filter></svg>
<svg xmlns='http://www.w3.org/2000/svg' height=0><filter id='mascot-filter' color-interpolation-filters='sRGB'><feColorMatrix values='#{Style.silhouette Style.matrix theme["Reply Background"], theme["Reply Background"]} 0 0 0 1 0' /></filter></svg>
<svg xmlns='http://www.w3.org/2000/svg' height=0><filter id='mascot-filter' color-interpolation-filters='sRGB'><feColorMatrix values='#{Style.silhouette Style.matrix theme["Reply Background"]} 0 0 0 1 0' /></filter></svg>
<svg xmlns='http://www.w3.org/2000/svg' height=0><filter id="grayscale"><feColorMatrix id="color" type="saturate" values="0" /></filter></svg>
<svg xmlns='http://www.w3.org/2000/svg' height=0><filter id="icons-filter" color-interpolation-filters='sRGB'><feColorMatrix values='-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0' /></filter></svg>
"""