fix: markdown webview dark mode

This commit is contained in:
Rongjian Zhang 2020-11-08 17:21:02 +08:00
parent 6f34c382be
commit 979e91378b
1 changed files with 15 additions and 1 deletions

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);
}
}