Skip to content

Instantly share code, notes, and snippets.

@joekukish
Last active August 29, 2015 14:05
Show Gist options
  • Save joekukish/be7f2a46511966ec2061 to your computer and use it in GitHub Desktop.
Save joekukish/be7f2a46511966ec2061 to your computer and use it in GitHub Desktop.
Stylus `font-smoothing` mixin
// Allows setting the font-smoothing option for styling better fonts. Font
// smoothing is specially valuable with custom fonts depending on the background
// color. Accepted values are none, antialiased, subpixel-antialiased.
//
// Usage:
// font-smoothing: antialiased;
//
// Compatibility untested.
font-smoothing() {
if current-property {
-webkit-{current-property}: arguments
if arguments == antialiased {
-moz-osx-{current-property}: grayscale
} else if arguments == subpixel-antialiased {
-moz-osx-{current-property}: auto
}
{current-property}: arguments
} else {
error('font-smoothing() must be used within a property');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment