[SCSS, some dart] Theme rework, dark dropped, nord replaces dark
The old dark mode is dropped and replaced with nord. Light and black themes were also rebased on the Nord theme. Code blocks now appear the same way my terminal windows appear in my Linux configuration, emulating a side titlebar.
This commit is contained in:
@@ -131,7 +131,6 @@ Future<Element> makeThemeChanger() async {
|
||||
..attributes['id'] = 'theme-dropdown'
|
||||
..append(makeThemeItem('lightBtn'))
|
||||
..append(makeThemeItem('darkBtn'))
|
||||
..append(makeThemeItem('nordBtn'))
|
||||
..append(makeThemeItem('blackBtn')));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,16 @@ import './navbar.dart' show makeNavbar;
|
||||
|
||||
const image_header = '/img/icon.webp';
|
||||
|
||||
Future<void> makeDecorativeButtonsOrgSrc() async {
|
||||
for (var pre in querySelectorAll('.org-src-container')) {
|
||||
pre
|
||||
..append(Element.div()..attributes['class'] = 'closeButton')
|
||||
..append(Element.div()..attributes['class'] = 'minButton')
|
||||
..append(Element.div()..attributes['class'] = 'maxButton')
|
||||
..append(Element.div()..attributes['class'] = 'floatButton');
|
||||
}
|
||||
}
|
||||
|
||||
Future<Element> makeHeader() async {
|
||||
var header = Element.tag('header');
|
||||
header
|
||||
@@ -54,6 +64,9 @@ Future<void> reorganizeHtml() async {
|
||||
// Make header
|
||||
final header = await makeHeader();
|
||||
|
||||
// Add decorative divs to source block wrappers
|
||||
await makeDecorativeButtonsOrgSrc();
|
||||
|
||||
// wrap tables in container for better SCSS display
|
||||
await wrapTables();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:html' show window, querySelector;
|
||||
final localStorage = window.localStorage;
|
||||
|
||||
Future<void> setTheme([String? theme]) async {
|
||||
theme ??= localStorage['theem'] ??
|
||||
theme ??= localStorage['theme'] ??
|
||||
(window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? 'dark'
|
||||
: 'light');
|
||||
@@ -14,7 +14,7 @@ Future<void> setTheme([String? theme]) async {
|
||||
}
|
||||
|
||||
void enableThemeChanger() {
|
||||
final themes = <String>['light', 'dark', 'nord', 'black'];
|
||||
final themes = <String>['light', 'dark', 'black'];
|
||||
themes.forEach((theme) =>
|
||||
querySelector('#${theme}Btn')!.onClick.listen((_) => setTheme(theme)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user