Skip to content

Commit

Permalink
fix: markdown webview dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed Nov 8, 2020
1 parent 6f34c38 commit 979e913
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/widgets/markdown_view.dart
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 979e913

Please sign in to comment.