Created
July 1, 2011 20:32
-
-
Save chriseppstein/1059334 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sass' | |
module Sass::Script::Functions | |
def svg_circle(radius, color, circle_type) | |
img = if circle_type.value == "disc" | |
%Q{<circle cx="#{radius.value}" cy="#{radius.value}" r="#{radius.value}" | |
stroke-width="0" fill="#{color}"/>} | |
else | |
%Q{<circle cx="#{radius.value}" cy="#{radius.value}" r="#{radius.value}" | |
stroke="#{color}" stroke-width="1" fill="white"/>} | |
end | |
inline_image_string(svg_circle_envelope(img).gsub(/ +/, ' '), 'image/svg+xml') | |
end | |
private | |
def svg_circle_envelope(content) | |
%Q{<?xml version="1.0" encoding="utf-8"?> <svg version="1.1" xmlns="http://www.w3.org/2000/svg">#{content}</svg>} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Draw a list style image in svg using the radius and color specified. | |
@mixin colored-bullet($radius, $color, $type: disc) { | |
list-style-type: $type; | |
list-style-image: svg-circle($radius, $color, $type); | |
} | |
ul { | |
@include colored-bullet(2px, $green, disc); | |
ul { | |
@include colored-bullet(2px, $green, circle); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thats bas ass