1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-15 09:56:15 +01:00

fix: markdown webview dark mode

This commit is contained in:
Rongjian Zhang 2020-11-08 17:21:02 +08:00
parent 6f34c382be
commit 979e91378b

View File

@ -63,7 +63,21 @@ class MarkdownWebView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
return HtmlView(html, cssText: theme.markdownCss);
var css = theme.markdownCss;
if (theme.brightness == Brightness.dark) {
css += '''
html {
background-color: #000;
}
.markdown-body {
filter:invert(100%);
}
.markdown-body img {
filter:invert(100%);
}'
''';
}
return HtmlView(html, cssText: css);
}
}