mirror of
https://github.com/DMOJ/online-judge.git
synced 2024-11-25 16:32:37 +08:00
Add querystring option to enable dark mode (attempt 2)
Second attempt of #2053
This commit is contained in:
parent
721033f165
commit
c7e9257e3f
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,6 +7,8 @@
|
||||
*~
|
||||
*.swp
|
||||
dmoj/local_settings.py
|
||||
resources/style.css
|
||||
resources/dark
|
||||
resources/martor-description.css
|
||||
resources/style.css
|
||||
resources/vars.scss
|
||||
sass_processed
|
||||
|
@ -24,6 +24,7 @@ def get_resource(request):
|
||||
else:
|
||||
scheme = 'http'
|
||||
return {
|
||||
'STYLE_CSS': 'dark/style.css' if request.GET.get('dark') else 'style.css',
|
||||
'PYGMENT_THEME': settings.PYGMENT_THEME,
|
||||
'INLINE_JQUERY': settings.INLINE_JQUERY,
|
||||
'INLINE_FONTAWESOME': settings.INLINE_FONTAWESOME,
|
||||
|
@ -14,10 +14,14 @@ if ! [ -x "$(command -v autoprefixer)" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILES=(sass_processed/style.css sass_processed/martor-description.css)
|
||||
|
||||
cd "$(dirname "$0")" || exit
|
||||
sass resources:sass_processed
|
||||
|
||||
echo
|
||||
postcss "${FILES[@]}" --verbose --use autoprefixer -d resources
|
||||
build_style() {
|
||||
echo "Creating $1 style..."
|
||||
cp resources/vars-$1.scss resources/vars.scss
|
||||
sass resources:sass_processed
|
||||
postcss sass_processed/style.css sass_processed/martor-description.css --verbose --use autoprefixer -d $2
|
||||
}
|
||||
|
||||
build_style 'default' 'resources'
|
||||
build_style 'dark' 'resources/dark'
|
||||
|
@ -1,3 +1,5 @@
|
||||
@import "vars";
|
||||
|
||||
.mwe-math-mathml-inline {
|
||||
display: inline !important;
|
||||
}
|
||||
@ -30,12 +32,12 @@
|
||||
|
||||
@font-face {
|
||||
font-family: 'Latin Modern Math';
|
||||
src: url('libs/latinmodernmath/latinmodern-math.eot'); /* IE9 Compat Modes */
|
||||
src: url($path_to_root + '/libs/latinmodernmath/latinmodern-math.eot'); /* IE9 Compat Modes */
|
||||
src: local('Latin Modern Math'), local('LatinModernMath-Regular'),
|
||||
url('libs/latinmodernmath/latinmodern-math.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url('libs/latinmodernmath/latinmodern-math.woff2') format('woff2'), /* Modern Browsers */
|
||||
url('libs/latinmodernmath/latinmodern-math.woff') format('woff'), /* Modern Browsers */
|
||||
url('libs/latinmodernmath/latinmodern-math.ttf') format('truetype'); /* Safari, Android, iOS */
|
||||
url($path_to_root + '/libs/latinmodernmath/latinmodern-math.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url($path_to_root + '/libs/latinmodernmath/latinmodern-math.woff2') format('woff2'), /* Modern Browsers */
|
||||
url($path_to_root + '/libs/latinmodernmath/latinmodern-math.woff') format('woff'), /* Modern Browsers */
|
||||
url($path_to_root + '/libs/latinmodernmath/latinmodern-math.ttf') format('truetype'); /* Safari, Android, iOS */
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
}
|
||||
|
||||
.wmd-button > span {
|
||||
background: url(pagedown/wmd-buttons.png) no-repeat 0 0;
|
||||
background: url($path_to_root + '/pagedown/wmd-buttons.png') no-repeat 0 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
display: inline-block;
|
||||
|
9
resources/vars-common.scss
Normal file
9
resources/vars-common.scss
Normal file
@ -0,0 +1,9 @@
|
||||
$highlight_blue: #2980B9;
|
||||
$announcement_red: #ae0000;
|
||||
|
||||
$base_font_size: 14px;
|
||||
$widget_border_radius: 4px;
|
||||
|
||||
$table_header_rounding: 6px;
|
||||
|
||||
$monospace-fonts: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;
|
19
resources/vars-dark.scss
Normal file
19
resources/vars-dark.scss
Normal file
@ -0,0 +1,19 @@
|
||||
@import "vars-common";
|
||||
|
||||
$color_primary0: #000;
|
||||
$color_primary5: #080808; // light background
|
||||
$color_primary10: #111; // background
|
||||
$color_primary25: #3b3b3b; // border
|
||||
$color_primary50: #808080;
|
||||
$color_primary75: #ccc; // widget
|
||||
$color_primary90: #eee;
|
||||
$color_primary100: #fff;
|
||||
|
||||
$color_link50: #06d; // default (title)
|
||||
$color_link75: #38e; // default
|
||||
$color_link100: #59f; // hover
|
||||
$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
|
19
resources/vars-default.scss
Normal file
19
resources/vars-default.scss
Normal file
@ -0,0 +1,19 @@
|
||||
@import "vars-common";
|
||||
|
||||
$color_primary0: #fff;
|
||||
$color_primary5: #f8f8f8; // light background
|
||||
$color_primary10: #eee; // background
|
||||
$color_primary25: #ccc; // border
|
||||
$color_primary50: #808080;
|
||||
$color_primary75: #3b3b3b; // widget
|
||||
$color_primary90: #111;
|
||||
$color_primary100: #000;
|
||||
|
||||
$color_link50: #5b80b9; // default (title)
|
||||
$color_link75: #1958c1; // default
|
||||
$color_link100: #0645ad; // hover
|
||||
$color_link200: #faa700; // active
|
||||
|
||||
$color_pageBg: #fff;
|
||||
|
||||
$path_to_root: '.'; // relative path from style.css to STATIC_ROOT
|
@ -1,27 +0,0 @@
|
||||
@use 'sass:color';
|
||||
|
||||
$color_primary0: #fff;
|
||||
$color_primary5: #f8f8f8; // light background
|
||||
$color_primary10: #eee; // background
|
||||
$color_primary25: #ccc; // border
|
||||
$color_primary50: #808080;
|
||||
$color_primary75: #3b3b3b; // widget
|
||||
$color_primary90: #111;
|
||||
$color_primary100: #000;
|
||||
|
||||
$color_link50: #5b80b9; // default (title)
|
||||
$color_link75: #1958c1; // default
|
||||
$color_link100: #0645ad; // hover
|
||||
$color_link200: #faa700; // active
|
||||
|
||||
$color_pageBg: color.adjust($color_primary5, $lightness: 10%);
|
||||
|
||||
$highlight_blue: #2980B9;
|
||||
$announcement_red: #ae0000;
|
||||
|
||||
$base_font_size: 14px;
|
||||
$widget_border_radius: 4px;
|
||||
|
||||
$table_header_rounding: 6px;
|
||||
|
||||
$monospace-fonts: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;
|
@ -48,7 +48,7 @@
|
||||
<link rel="stylesheet" href="{{ FONTAWESOME_CSS }}">
|
||||
{% endif %}
|
||||
{% compress css %}
|
||||
<link rel="stylesheet" href="{{ static('style.css') }}">
|
||||
<link rel="stylesheet" href="{{ static(STYLE_CSS) }}">
|
||||
{% if PYGMENT_THEME %}
|
||||
<link rel="stylesheet" href="{{ static(PYGMENT_THEME) }}">
|
||||
{% endif %}{% if INLINE_FONTAWESOME %}
|
||||
|
Loading…
Reference in New Issue
Block a user