Theme changer works, now I have to make it permanent
parent
37d735cfdd
commit
05e374dd27
@ -1,5 +1,8 @@
|
||||
import './reorganize_html.dart' show reorganizeHtml;
|
||||
import './theme.dart' show makeThemeChanger;
|
||||
|
||||
void main() {
|
||||
reorganizeHtml();
|
||||
Future<void> main() async {
|
||||
await reorganizeHtml().then((_) {
|
||||
makeThemeChanger();
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
import 'dart:html';
|
||||
|
||||
void switchTheme(final Element body, String theme) {
|
||||
body.classes.clear();
|
||||
body.classes.add(theme);
|
||||
}
|
||||
|
||||
void makeThemeChanger() {
|
||||
final darkBtn = querySelector('#darkBtn');
|
||||
final lightBtn = querySelector('#lightBtn');
|
||||
final body = querySelector('body');
|
||||
|
||||
darkBtn.onClick.listen((_) {
|
||||
switchTheme(body, 'dark');
|
||||
});
|
||||
|
||||
lightBtn.onClick.listen((_) {
|
||||
switchTheme(body, 'light');
|
||||
});
|
||||
}
|
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700);@font-face{font-family:"DoulosSIL";font-display:swap;src:url("https://langue.phundrak.com/fonts/DoulosSIL-R.woff")}@font-face{font-family:"Noto Sans Runes";font-display:swap;src:url("../fonts/NotoSansRunic-Regular.ttf")}@font-face{font-family:"Helvetica Neue";font-display:swap;src:url("../fonts/HelveticaNeue.ttf")}body{margin:0;padding:0;font-family:"Noto Sans Runes", "DoulosSIL", "Lato", "proxima-nova", "Helvetica Neue", Arial, sans-serif}ul{list-style-type:none;margin:0;padding:0}a{color:currentColor;text-decoration:none}.navbar{height:70px;width:100%;background:black;color:white}.navbar-nav{display:flex;align-items:center;justify-content:space-evenly;height:100%}header{padding:1em;background:red;margin-bottom:1em;padding-bottom:3.5em;text-align:center;clip-path:polygon(50% 0%, 100% 0, 100% 65%, 50% 100%, 0 65%, 0 0)}.dropdown{position:absolute;width:500px;opacity:0;z-index:2;background:blue;border-top:2px solid white;border-bottom-right-radius:8px;border-bottom-left-radius:8px;display:flex;align-items:center;justify-content:space-around;height:3rem;margin-top:2rem;padding:0.5rem;box-shadow:rgba(2,8,20,0.1) 0px 0.175em 0.5em;transform:translateX(-40%);transition:opacity .15s ease-out}#theme-dropdown{width:300px;transform:translateX(-60%)}.has-dropdown:focus-within .dropdown{opacity:1;pointer-events:auto}.dropdown-item a{width:100%;height:100%;size:0.7rem;padding-left:10px;font-weight:bold}
|
||||
/*# sourceMappingURL=style.css.map */
|
Reference in New Issue