Skip to content

Instantly share code, notes, and snippets.

@autr
Created April 3, 2020 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save autr/41484ae9b172d6211e16cc9a3c590adf to your computer and use it in GitHub Desktop.
Save autr/41484ae9b172d6211e16cc9a3c590adf to your computer and use it in GitHub Desktop.
SASS - subtle dark mode
// dark mode options...
$invert: true
// differences between dark grays are more visible when inverted into light grays...
$pushInvertedBrightness: 0.01
// color functions...
@function mono($l)
@return hsl(0,0%,$l)
// this exponential function will "push" light grays toward white...
@function getMono($l)
@if $invert
@return hsl( 0, 0%, 100 - ($l * ( 1 - ( (100-$l) * $pushInvertedBrightness ) ) ) )
@else
@return hsl( 0, 0%, $l )
// theme...
$color: #EE3987
$darkest: getMono(10)
$dark: getMono(30)
$midGray: getMono(60)
$midGray2: getMono(70)
$light: getMono(90)
$lightest: getMono(96)
$white: getMono( 100 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment