Created
February 22, 2014 11:46
-
-
Save RoelN/9152657 to your computer and use it in GitHub Desktop.
Trying to avoid duplicating SVGs in Grunticon
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<style> | |
.bear { | |
width: 100px; | |
height: 62.905px; | |
/* X should be width * number of color variations */ | |
background-size: 500px 62.905px; | |
background-repeat: no-repeat; | |
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%22500%22%20height%3D%2262.905px%22%3E%3Cdefs%3E%3Cpath%20id%3D%22bear%22%20d%3D%22M11.068%2C34.558c-1.585-2.365-2.595-5.098-2.939-8.106c-0.344%2C0.092-0.666%2C0.161-1.033%2C0.161%20c-2.342%2C0-4.248-1.906-4.248-4.248c0-1.47%2C0.758-2.756%2C1.883-3.514l12.147-8.45c2.549-1.562%2C5.534-2.526%2C8.749-2.641l30.149%2C0.092%20L77.819%2C4.34c0-0.115%2C0-0.229%2C0-0.345C77.819%2C1.791%2C79.586%2C0%2C81.791%2C0c2.205%2C0%2C3.996%2C1.791%2C3.996%2C3.995%20c0%2C0.345-0.046%2C0.712-0.138%2C1.034l2.043%2C0.275c2.365%2C0.459%2C4.156%2C2.549%2C4.156%2C5.052c0%2C0.161%2C0%2C0.298-0.022%2C0.436l6.544%2C3.536%20c0.941%2C0.368%2C1.63%2C1.309%2C1.63%2C2.388c0%2C0.367-0.068%2C0.689-0.206%2C1.01l-1.631%2C3.697c-0.804%2C1.309-2.181%2C2.228-3.788%2C2.411%20l-15.041%2C1.791L65.787%2C41.527l7.738%2C13.363l5.098%2C2.365c0.803%2C0.552%2C1.354%2C1.493%2C1.354%2C2.549c0%2C1.699-1.378%2C3.078-3.101%2C3.078%20l-9.805%2C0.022c-2.525%2C0-4.707-1.424-5.809-3.49l-8.382-15.155l-18.92%2C0.023l6.682%2C10.287l4.937%2C2.25%20c0.919%2C0.551%2C1.516%2C1.538%2C1.516%2C2.664c0%2C1.699-1.378%2C3.076-3.077%2C3.076l-9.828%2C0.023c-2.388%2C0-4.5-1.286-5.649-3.215l-9.208-14.627%20l-6.429%2C6.246l-0.528%2C4.087l2.158%2C1.423c0.368%2C0.184%2C0.689%2C0.438%2C0.965%2C0.758c1.056%2C1.332%2C0.872%2C3.284-0.459%2C4.34%20c-0.574%2C0.482-1.286%2C0.713-1.975%2C0.689l-4.317%2C0.023c-1.194-0.139-2.273-0.758-2.962-1.677l-5.029-8.68C0.275%2C51.033%2C0%2C50%2C0%2C48.898%20c0-1.676%2C0.62-3.215%2C1.676-4.387L11.068%2C34.558z%22%2F%3E%3C%2Fdefs%3E%3Cuse%20xlink%3Ahref%3D%22%23bear%22%20x%3D%220%22%20y%3D%220%22%20style%3D%22fill%3Ablue%22%2F%3E%3Cuse%20xlink%3Ahref%3D%22%23bear%22%20x%3D%22100%22%20y%3D%220%22%20style%3D%22fill%3Ared%22%2F%3E%3Cuse%20xlink%3Ahref%3D%22%23bear%22%20x%3D%22200%22%20y%3D%220%22%20style%3D%22fill%3Apurple%22%2F%3E%3Cuse%20xlink%3Ahref%3D%22%23bear%22%20x%3D%22300%22%20y%3D%220%22%20style%3D%22fill%3Agreen%22%2F%3E%3Cuse%20xlink%3Ahref%3D%22%23bear%22%20x%3D%22400%22%20y%3D%220%22%20style%3D%22fill%3Aorange%22%2F%3E%3C%2Fsvg%3E'); | |
} | |
.cat { | |
width: 100px; | |
height: 100px; | |
/* X should be width * number of color variations */ | |
background-size: 500px 100px; | |
background-repeat: no-repeat; | |
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22500%22%20height%3D%22100%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%3Cdefs%3E%3Cpath%20id%3D%22cat%22%20d%3D%22M95.838%2042.306c-.574-.66-3.049-2.023-3.554-3.61-1.38-4.999-7.236-6.833-7.236-6.833l.628-9.124c-2.598.792-6.201%203.782-9.97%207.567-.587-.076-1.188-.13-1.8-.13-4.327%200-8.182%202.015-10.691%205.148-5.458-4.478-11.402-7.598-21.055-7.255-20.434.731-31.635%2014.535-35.311%2033.63-4.699%203.742-4.914%207.912-4.554%2010.211%201.093%207.012%209.395%2012.104%2014.94%2013.479%2016.643%204.131%2033.75-2.756%2043.576-17.537%201.319-1.981.78-4.656-1.205-5.975-1.979-1.318-4.653-.779-5.974%201.201-7.785%2011.711-21.257%2017.186-34.322%2013.943-3.631-.902-7.785-3.978-8.427-6.16l1.092.275h29.703c3.791-2.306%207.156-5.5%209.806-9.486%202.104-3.17%206.396-4.029%209.562-1.926%203.164%202.106%204.03%206.395%201.925%209.562-.422.631-.859%201.244-1.304%201.851h17.927c-.07-.146.077-.062.077-.062-.149-.224-1.819-2.816-2.006-5.765-.353-5.58%203.39-10.199%203.39-10.199l.039-.055c11.692%202.043%2014.223-5.297%2014.871-8.869.299-1.65.898-3.19-.127-3.881zm-9.836-1.283c-.891%200-1.613-.723-1.613-1.614%200-.892.723-1.614%201.613-1.614.892%200%201.614.723%201.614%201.614%200%20.891-.722%201.614-1.614%201.614z%22%2F%3E%3C%2Fdefs%3E%3Cuse%20xlink%3Ahref%3D%22%23cat%22%20x%3D%220%22%20y%3D%220%22%20style%3D%22fill%3Ablue%22%2F%3E%3Cuse%20xlink%3Ahref%3D%22%23cat%22%20x%3D%22100%22%20y%3D%220%22%20style%3D%22fill%3Ared%22%2F%3E%3Cuse%20xlink%3Ahref%3D%22%23cat%22%20x%3D%22200%22%20y%3D%220%22%20style%3D%22fill%3Apurple%22%2F%3E%3Cuse%20xlink%3Ahref%3D%22%23cat%22%20x%3D%22300%22%20y%3D%220%22%20style%3D%22fill%3Agreen%22%2F%3E%3Cuse%20xlink%3Ahref%3D%22%23cat%22%20x%3D%22400%22%20y%3D%220%22%20style%3D%22fill%3Aorange%22%2F%3E%3C%2Fsvg%3E'); | |
} | |
/* Generic styles for all icons that have 5 colors */ | |
.color-2 { | |
background-position: 25% 0; | |
} | |
.color-3 { | |
background-position: 50% 0; | |
} | |
.color-4 { | |
background-position: 75% 0; | |
} | |
.color-5 { | |
background-position: 100% 0; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="bear"></div> | |
<div class="bear color-2"></div> | |
<div class="bear color-3"></div> | |
<div class="bear color-4"></div> | |
<div class="bear color-5"></div> | |
<div class="cat"></div> | |
<div class="cat color-2"></div> | |
<div class="cat color-3"></div> | |
<div class="cat color-4"></div> | |
<div class="cat color-5"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment