Permalink
Browse files

reinstate default background fill code

  • Loading branch information...
1 parent ccadafc commit 84cb1e019a3d6ab9dadeaa3cb51f294b8f46ca50 @tlconnor tlconnor committed Mar 2, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/scruffy/components/background.rb
View
2 lib/scruffy/components/background.rb
@@ -7,7 +7,7 @@ def draw(svg, bounds, options={})
when Symbol, String
fill = options[:theme].background.to_s
when Array
- fill = "#{options[:theme].background[0]}"
+ fill = "url(#BackgroundGradient) #{options[:theme].background[0]}" # the second part is a fallback for Firefox, which does support gradient fills, but unfortunately can't handle url(#fragment) references for SVGs loaded from a data: URI (whereas it does work ok for external images); if we don't specify a solid fallback color it fills black!
svg.defs {
svg.linearGradient(:id=>'BackgroundGradient', :x1 => '0%', :y1 => '0%', :x2 => '0%', :y2 => '100%') {
svg.stop(:offset => '5%', 'stop-color' => options[:theme].background[0])

0 comments on commit 84cb1e0

Please sign in to comment.