Last active
December 20, 2015 23:49
-
-
Save mochja/6215631 to your computer and use it in GitHub Desktop.
Split images, make opacity version, LESS function. (all icons are in simple png file along with hover versions)
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
@img-count: 4; // you need keep count of your images | |
@icon-width: 40px; | |
.image-icon (@pos: 0) when (@pos = 1) { | |
background-position-y: 0; | |
&:hover, &.active { | |
background-position-y: (@icon-width * -@img-count); | |
} | |
} | |
.image-icon (@pos: 0) when (@pos > 1) { | |
background-position-y: (-@icon-width * (@pos - 1)); | |
&:hover, &.active { | |
background-position-y: (-@icon-width * ( @pos + @img-count - 1 ) ); | |
} | |
} |
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
#!/bin/bash | |
convert image_* -append full.png | |
convert full.png -channel Alpha -evaluate Divide 1.5 full_opacity.png | |
convert full* -append icons.png |
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
a.icon { | |
background-image: url(../img/icons.png); | |
background-repeat: no-repeat; | |
background-position-x: 15px; | |
&.diary { | |
.image-icon(1); | |
} | |
&.info { | |
.image-icon(2); | |
} | |
&.docs { | |
.image-icon(3); | |
} | |
&.export { | |
.image-icon(4); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment