QuickSnip LogoA light blue logo with a thunderbolt in bracketsQuickSnip

Dark Theme

SCSS mixin to change styles for dark themes.

  • mixin
  • snippet
  • dark-theme
  • layout

Code

@mixin isDark($type: 'module') {
  $root: &;

  @if $type == 'module' {
    :global {
      @at-root body[theme='dark'] #{$root} {
        @content;
      }
    }
  } @else {
    &[theme='dark'] {
      @content;
    }
  }
}

Usage

.container{
	background: #f0f0f0;
	@include isDark {
		background: #222;
	}
}