Skip to content

Commit 53992eb

Browse files
authored
dark theme mixin for scss
1 parent f1f3b6a commit 53992eb

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

snippets/scss/layouts/dark-theme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Dark Theme
3+
description: SCSS mixin to change styles for dark themes
4+
tags: scss, css, mixin, snippet, dark-theme, layout
5+
author: gihanrangana
6+
---
7+
8+
```scss
9+
@mixin isDark($type: 'module') {
10+
$root: &;
11+
12+
@if $type == 'module' {
13+
:global {
14+
@at-root body[theme='dark'] #{$root} {
15+
@content;
16+
}
17+
}
18+
} @else {
19+
&[theme='dark'] {
20+
@content;
21+
}
22+
}
23+
}
24+
```

0 commit comments

Comments
 (0)