mirror of https://github.com/python/cpython
gh-123430: Add dark mode support to pages generated by http.server (#123475)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
13f61bf7f1
commit
9684f40b9f
|
@ -151,6 +151,14 @@ Added support for converting any objects that have the
|
||||||
(Contributed by Serhiy Storchaka in :gh:`82017`.)
|
(Contributed by Serhiy Storchaka in :gh:`82017`.)
|
||||||
|
|
||||||
|
|
||||||
|
http
|
||||||
|
----
|
||||||
|
|
||||||
|
Directory lists and error pages generated by the :mod:`http.server`
|
||||||
|
module allow the browser to apply its default dark mode.
|
||||||
|
(Contributed by Yorik Hansen in :gh:`123430`.)
|
||||||
|
|
||||||
|
|
||||||
json
|
json
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,11 @@ DEFAULT_ERROR_MESSAGE = """\
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<style type="text/css">
|
||||||
|
:root {
|
||||||
|
color-scheme: light dark;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<title>Error response</title>
|
<title>Error response</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -804,6 +809,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
|
||||||
r.append('<html lang="en">')
|
r.append('<html lang="en">')
|
||||||
r.append('<head>')
|
r.append('<head>')
|
||||||
r.append(f'<meta charset="{enc}">')
|
r.append(f'<meta charset="{enc}">')
|
||||||
|
r.append('<style type="text/css">\n:root {\ncolor-scheme: light dark;\n}\n</style>')
|
||||||
r.append(f'<title>{title}</title>\n</head>')
|
r.append(f'<title>{title}</title>\n</head>')
|
||||||
r.append(f'<body>\n<h1>{title}</h1>')
|
r.append(f'<body>\n<h1>{title}</h1>')
|
||||||
r.append('<hr>\n<ul>')
|
r.append('<hr>\n<ul>')
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Pages generated by the :mod:`http.server` module allow the browser to apply its default dark mode.
|
Loading…
Reference in New Issue