diff --git a/dmoj/settings.py b/dmoj/settings.py index cd4f7eeed0..2a7dc9871e 100644 --- a/dmoj/settings.py +++ b/dmoj/settings.py @@ -145,7 +145,6 @@ SELENIUM_CUSTOM_CHROME_PATH = None SELENIUM_CHROMEDRIVER_PATH = 'chromedriver' -PYGMENT_THEME = 'pygment-github.css' INLINE_JQUERY = True INLINE_FONTAWESOME = True JQUERY_JS = '//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js' diff --git a/judge/management/commands/render_pdf.py b/judge/management/commands/render_pdf.py index eff831c3f1..cf638c7678 100644 --- a/judge/management/commands/render_pdf.py +++ b/judge/management/commands/render_pdf.py @@ -51,7 +51,7 @@ def handle(self, *args, **options): 'math_engine': maker.math_engine, }).replace('"//', '"https://').replace("'//", "'https://") maker.title = problem_name - for file in ('style.css', 'pygment-github.css', 'mathjax_config.js'): + for file in ('style.css', 'mathjax_config.js'): maker.load(file, os.path.join(settings.DMOJ_RESOURCES, file)) maker.make(debug=True) if not maker.success: diff --git a/judge/template_context.py b/judge/template_context.py index 2f420940f3..e4cc47846a 100644 --- a/judge/template_context.py +++ b/judge/template_context.py @@ -25,7 +25,6 @@ def get_resource(request): scheme = 'http' return { 'STYLE_CSS': 'dark/style.css' if 'dark' in request.GET else 'style.css', - 'PYGMENT_THEME': settings.PYGMENT_THEME, 'INLINE_JQUERY': settings.INLINE_JQUERY, 'INLINE_FONTAWESOME': settings.INLINE_FONTAWESOME, 'JQUERY_JS': settings.JQUERY_JS, diff --git a/judge/views/problem.py b/judge/views/problem.py index 42e40234ae..07fec5f760 100644 --- a/judge/views/problem.py +++ b/judge/views/problem.py @@ -325,7 +325,7 @@ def get(self, request, *args, **kwargs): }).replace('"//', '"https://').replace("'//", "'https://") maker.title = problem_name - assets = ['style.css', 'pygment-github.css'] + assets = ['style.css'] if maker.math_engine == 'jax': assets.append('mathjax_config.js') for file in assets: diff --git a/resources/pygment-github.css b/resources/pygment-github.css deleted file mode 100644 index 567fe1dea9..0000000000 --- a/resources/pygment-github.css +++ /dev/null @@ -1,61 +0,0 @@ -code .hll { background-color: #ffffcc } -code .c { color: #999988; font-style: italic } /* Comment */ -code .err { color: #a61717; background-color: #e3d2d2 } /* Error */ -code .k { color: #000000; font-weight: bold } /* Keyword */ -code .o { color: #000000; font-weight: bold } /* Operator */ -code .cm { color: #999988; font-style: italic } /* Comment.Multiline */ -code .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */ -code .c1 { color: #999988; font-style: italic } /* Comment.Single */ -code .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ -code .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ -code .ge { color: #000000; font-style: italic } /* Generic.Emph */ -code .gr { color: #aa0000 } /* Generic.Error */ -code .gh { color: #999999 } /* Generic.Heading */ -code .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ -code .go { color: #888888 } /* Generic.Output */ -code .gp { color: #555555 } /* Generic.Prompt */ -code .gs { font-weight: bold } /* Generic.Strong */ -code .gu { color: #aaaaaa } /* Generic.Subheading */ -code .gt { color: #aa0000 } /* Generic.Traceback */ -code .kc { color: #000000; font-weight: bold } /* Keyword.Constant */ -code .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */ -code .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */ -code .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */ -code .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */ -code .kt { color: #445588; font-weight: bold } /* Keyword.Type */ -code .m { color: #009999 } /* Literal.Number */ -code .s { color: #d01040 } /* Literal.String */ -code .na { color: #008080 } /* Name.Attribute */ -code .nb { color: #0086B3 } /* Name.Builtin */ -code .nc { color: #445588; font-weight: bold } /* Name.Class */ -code .no { color: #008080 } /* Name.Constant */ -code .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */ -code .ni { color: #800080 } /* Name.Entity */ -code .ne { color: #990000; font-weight: bold } /* Name.Exception */ -code .nf { color: #990000; font-weight: bold } /* Name.Function */ -code .nl { color: #990000; font-weight: bold } /* Name.Label */ -code .nn { color: #555555 } /* Name.Namespace */ -code .nt { color: #000080 } /* Name.Tag */ -code .nv { color: #008080 } /* Name.Variable */ -code .ow { color: #000000; font-weight: bold } /* Operator.Word */ -code .w { color: #bbbbbb } /* Text.Whitespace */ -code .mf { color: #009999 } /* Literal.Number.Float */ -code .mh { color: #009999 } /* Literal.Number.Hex */ -code .mi { color: #009999 } /* Literal.Number.Integer */ -code .mo { color: #009999 } /* Literal.Number.Oct */ -code .sb { color: #d01040 } /* Literal.String.Backtick */ -code .sc { color: #d01040 } /* Literal.String.Char */ -code .sd { color: #d01040 } /* Literal.String.Doc */ -code .s2 { color: #d01040 } /* Literal.String.Double */ -code .se { color: #d01040 } /* Literal.String.Escape */ -code .sh { color: #d01040 } /* Literal.String.Heredoc */ -code .si { color: #d01040 } /* Literal.String.Interpol */ -code .sx { color: #d01040 } /* Literal.String.Other */ -code .sr { color: #009926 } /* Literal.String.Regex */ -code .s1 { color: #d01040 } /* Literal.String.Single */ -code .ss { color: #990073 } /* Literal.String.Symbol */ -code .bp { color: #999999 } /* Name.Builtin.Pseudo */ -code .vc { color: #008080 } /* Name.Variable.Class */ -code .vg { color: #008080 } /* Name.Variable.Global */ -code .vi { color: #008080 } /* Name.Variable.Instance */ -code .il { color: #009999 } /* Literal.Number.Integer.Long */ diff --git a/resources/pygment-github.scss b/resources/pygment-github.scss new file mode 100644 index 0000000000..64f5d2b0c4 --- /dev/null +++ b/resources/pygment-github.scss @@ -0,0 +1,147 @@ +@import "vars"; + +code { + @if $is_light_theme { + .hll { background-color: #ffffcc } + .c { color: #999988; font-style: italic } /* Comment */ + .err { color: #a61717; background-color: #e3d2d2 } /* Error */ + .k { color: #000000; font-weight: bold } /* Keyword */ + .o { color: #000000; font-weight: bold } /* Operator */ + .cm { color: #999988; font-style: italic } /* Comment.Multiline */ + .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */ + .c1 { color: #999988; font-style: italic } /* Comment.Single */ + .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ + .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ + .ge { color: #000000; font-style: italic } /* Generic.Emph */ + .gr { color: #aa0000 } /* Generic.Error */ + .gh { color: #999999 } /* Generic.Heading */ + .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ + .go { color: #888888 } /* Generic.Output */ + .gp { color: #555555 } /* Generic.Prompt */ + .gs { font-weight: bold } /* Generic.Strong */ + .gu { color: #aaaaaa } /* Generic.Subheading */ + .gt { color: #aa0000 } /* Generic.Traceback */ + .kc { color: #000000; font-weight: bold } /* Keyword.Constant */ + .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */ + .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */ + .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */ + .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */ + .kt { color: #445588; font-weight: bold } /* Keyword.Type */ + .m { color: #009999 } /* Literal.Number */ + .s { color: #d01040 } /* Literal.String */ + .na { color: #008080 } /* Name.Attribute */ + .nb { color: #0086B3 } /* Name.Builtin */ + .nc { color: #445588; font-weight: bold } /* Name.Class */ + .no { color: #008080 } /* Name.Constant */ + .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */ + .ni { color: #800080 } /* Name.Entity */ + .ne { color: #990000; font-weight: bold } /* Name.Exception */ + .nf { color: #990000; font-weight: bold } /* Name.Function */ + .nl { color: #990000; font-weight: bold } /* Name.Label */ + .nn { color: #555555 } /* Name.Namespace */ + .nt { color: #000080 } /* Name.Tag */ + .nv { color: #008080 } /* Name.Variable */ + .ow { color: #000000; font-weight: bold } /* Operator.Word */ + .w { color: #bbbbbb } /* Text.Whitespace */ + .mf { color: #009999 } /* Literal.Number.Float */ + .mh { color: #009999 } /* Literal.Number.Hex */ + .mi { color: #009999 } /* Literal.Number.Integer */ + .mo { color: #009999 } /* Literal.Number.Oct */ + .sb { color: #d01040 } /* Literal.String.Backtick */ + .sc { color: #d01040 } /* Literal.String.Char */ + .sd { color: #d01040 } /* Literal.String.Doc */ + .s2 { color: #d01040 } /* Literal.String.Double */ + .se { color: #d01040 } /* Literal.String.Escape */ + .sh { color: #d01040 } /* Literal.String.Heredoc */ + .si { color: #d01040 } /* Literal.String.Interpol */ + .sx { color: #d01040 } /* Literal.String.Other */ + .sr { color: #009926 } /* Literal.String.Regex */ + .s1 { color: #d01040 } /* Literal.String.Single */ + .ss { color: #990073 } /* Literal.String.Symbol */ + .bp { color: #999999 } /* Name.Builtin.Pseudo */ + .vc { color: #008080 } /* Name.Variable.Class */ + .vg { color: #008080 } /* Name.Variable.Global */ + .vi { color: #008080 } /* Name.Variable.Instance */ + .il { color: #009999 } /* Literal.Number.Integer.Long */ + } @else { + .hll { background-color: #6e7681 } + .c { color: #8b949e; font-style: italic } /* Comment */ + .err { color: #f85149 } /* Error */ + .esc { color: #c9d1d9 } /* Escape */ + .g { color: #c9d1d9 } /* Generic */ + .k { color: #ff7b72 } /* Keyword */ + .l { color: #a5d6ff } /* Literal */ + .n { color: #c9d1d9 } /* Name */ + .o { color: #ff7b72; font-weight: bold } /* Operator */ + .x { color: #c9d1d9 } /* Other */ + .p { color: #c9d1d9 } /* Punctuation */ + .ch { color: #8b949e; font-style: italic } /* Comment.Hashbang */ + .cm { color: #8b949e; font-style: italic } /* Comment.Multiline */ + .cp { color: #8b949e; font-weight: bold; font-style: italic } /* Comment.Preproc */ + .cpf { color: #8b949e; font-style: italic } /* Comment.PreprocFile */ + .c1 { color: #8b949e; font-style: italic } /* Comment.Single */ + .cs { color: #8b949e; font-weight: bold; font-style: italic } /* Comment.Special */ + .gd { color: #ffa198; background-color: #490202 } /* Generic.Deleted */ + .ge { color: #c9d1d9; font-style: italic } /* Generic.Emph */ + .gr { color: #ffa198 } /* Generic.Error */ + .gh { color: #79c0ff; font-weight: bold } /* Generic.Heading */ + .gi { color: #56d364; background-color: #0f5323 } /* Generic.Inserted */ + .go { color: #8b949e } /* Generic.Output */ + .gp { color: #8b949e } /* Generic.Prompt */ + .gs { color: #c9d1d9; font-weight: bold } /* Generic.Strong */ + .gu { color: #79c0ff } /* Generic.Subheading */ + .gt { color: #ff7b72 } /* Generic.Traceback */ + .g-Underline { color: #c9d1d9; text-decoration: underline } /* Generic.Underline */ + .kc { color: #79c0ff } /* Keyword.Constant */ + .kd { color: #ff7b72 } /* Keyword.Declaration */ + .kn { color: #ff7b72 } /* Keyword.Namespace */ + .kp { color: #79c0ff } /* Keyword.Pseudo */ + .kr { color: #ff7b72 } /* Keyword.Reserved */ + .kt { color: #ff7b72 } /* Keyword.Type */ + .ld { color: #79c0ff } /* Literal.Date */ + .m { color: #a5d6ff } /* Literal.Number */ + .s { color: #a5d6ff } /* Literal.String */ + .na { color: #c9d1d9 } /* Name.Attribute */ + .nb { color: #c9d1d9 } /* Name.Builtin */ + .nc { color: #f0883e; font-weight: bold } /* Name.Class */ + .no { color: #79c0ff; font-weight: bold } /* Name.Constant */ + .nd { color: #d2a8ff; font-weight: bold } /* Name.Decorator */ + .ni { color: #ffa657 } /* Name.Entity */ + .ne { color: #f0883e; font-weight: bold } /* Name.Exception */ + .nf { color: #d2a8ff; font-weight: bold } /* Name.Function */ + .nl { color: #79c0ff; font-weight: bold } /* Name.Label */ + .nn { color: #ff7b72 } /* Name.Namespace */ + .nx { color: #c9d1d9 } /* Name.Other */ + .py { color: #79c0ff } /* Name.Property */ + .nt { color: #7ee787 } /* Name.Tag */ + .nv { color: #79c0ff } /* Name.Variable */ + .ow { color: #ff7b72; font-weight: bold } /* Operator.Word */ + .pm { color: #c9d1d9 } /* Punctuation.Marker */ + .w { color: #6e7681 } /* Text.Whitespace */ + .mb { color: #a5d6ff } /* Literal.Number.Bin */ + .mf { color: #a5d6ff } /* Literal.Number.Float */ + .mh { color: #a5d6ff } /* Literal.Number.Hex */ + .mi { color: #a5d6ff } /* Literal.Number.Integer */ + .mo { color: #a5d6ff } /* Literal.Number.Oct */ + .sa { color: #79c0ff } /* Literal.String.Affix */ + .sb { color: #a5d6ff } /* Literal.String.Backtick */ + .sc { color: #a5d6ff } /* Literal.String.Char */ + .dl { color: #79c0ff } /* Literal.String.Delimiter */ + .sd { color: #a5d6ff } /* Literal.String.Doc */ + .s2 { color: #a5d6ff } /* Literal.String.Double */ + .se { color: #79c0ff } /* Literal.String.Escape */ + .sh { color: #79c0ff } /* Literal.String.Heredoc */ + .si { color: #a5d6ff } /* Literal.String.Interpol */ + .sx { color: #a5d6ff } /* Literal.String.Other */ + .sr { color: #79c0ff } /* Literal.String.Regex */ + .s1 { color: #a5d6ff } /* Literal.String.Single */ + .ss { color: #a5d6ff } /* Literal.String.Symbol */ + .bp { color: #c9d1d9 } /* Name.Builtin.Pseudo */ + .fm { color: #d2a8ff; font-weight: bold } /* Name.Function.Magic */ + .vc { color: #79c0ff } /* Name.Variable.Class */ + .vg { color: #79c0ff } /* Name.Variable.Global */ + .vi { color: #79c0ff } /* Name.Variable.Instance */ + .vm { color: #79c0ff } /* Name.Variable.Magic */ + .il { color: #a5d6ff } /* Literal.Number.Integer.Long */ + } +} diff --git a/resources/style.scss b/resources/style.scss index 635ff99d22..c2447445eb 100644 --- a/resources/style.scss +++ b/resources/style.scss @@ -1,4 +1,5 @@ @import "base"; +@import "pygment-github"; @import "table"; @import "math"; @import "status"; diff --git a/resources/vars-dark.scss b/resources/vars-dark.scss index 730a702d44..9b7cc6fa53 100644 --- a/resources/vars-dark.scss +++ b/resources/vars-dark.scss @@ -1,5 +1,7 @@ @import "vars-common"; +$is_light_theme: false; + $color_primary0: #000; $color_primary5: #080808; // light background $color_primary10: #111; // background diff --git a/resources/vars-default.scss b/resources/vars-default.scss index 63db602c12..3333186d68 100644 --- a/resources/vars-default.scss +++ b/resources/vars-default.scss @@ -1,5 +1,7 @@ @import "vars-common"; +$is_light_theme: true; + $color_primary0: #fff; $color_primary5: #f8f8f8; // light background $color_primary10: #eee; // background diff --git a/templates/base.html b/templates/base.html index 1e6c7191bc..f699157708 100644 --- a/templates/base.html +++ b/templates/base.html @@ -45,10 +45,7 @@ {% endif %} {% compress css %} - {% if PYGMENT_THEME %} - - {% endif %}{% if INLINE_FONTAWESOME %} - {% endif %} + {% if INLINE_FONTAWESOME %}{% endif %} {% endcompress %} diff --git a/templates/problem/raw.html b/templates/problem/raw.html index 0d765e91ff..d6901d88f5 100644 --- a/templates/problem/raw.html +++ b/templates/problem/raw.html @@ -2,7 +2,6 @@ -