Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dark mode images #2084

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions judge/jinja2/markdown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ def block_html(self, html):
return '<pre>%s</pre>' % mistune.escape(latex, smart_amp=False)
elif 'error' not in result:
img = ('''<img src="%(svg)s" onerror="this.src='%(png)s';this.onerror=null"'''
'width="%(width)s" height="%(height)s"%(tail)s>') % {
'class="tex-full" width="%(width)s" height="%(height)s"%(tail)s>') % {
'svg': result['svg'], 'png': result['png'],
'width': result['meta']['width'], 'height': result['meta']['height'],
'tail': ' /' if self.options.get('use_xhtml') else '',
}
style = ['max-width: 100%',
'height: %s' % result['meta']['height'],
'max-height: %s' % result['meta']['height'],
'width: %s' % result['meta']['height']]
'width: %s' % result['meta']['width']]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful.

if 'inline' in attr:
tag = 'span'
else:
Expand Down
4 changes: 4 additions & 0 deletions resources/base-description.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
height: auto;
}

img.tex-full {
@include vars-img;
}

h1, h2, h3, h4, h5, h6 {
font-weight: normal;
color: $color_primary90;
Expand Down
1 change: 1 addition & 0 deletions resources/pagedown-widget.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
}

.wmd-button > span {
@include vars-img;
background: url($path_to_root + '/pagedown/wmd-buttons.png') no-repeat 0 0;
width: 20px;
height: 20px;
Expand Down
4 changes: 4 additions & 0 deletions resources/vars-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ $color_link200: #960; // active
$color_pageBg: #222; // #222 because some elements should be darker than pageBg

$path_to_root: '..'; // relative path from style.css to STATIC_ROOT

@mixin vars-img {
filter: invert(1) hue-rotate(180deg);
}
2 changes: 2 additions & 0 deletions resources/vars-default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ $color_link200: #faa700; // active
$color_pageBg: #fff;

$path_to_root: '.'; // relative path from style.css to STATIC_ROOT

@mixin vars-img {}