mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-129939: Add darkmode support for difflib's comparison pages (#129940)
This commit is contained in:
parent
3b366a4a4b
commit
12bd15f7b3
4 changed files with 30 additions and 3 deletions
|
@ -411,6 +411,13 @@ decimal
|
||||||
:meth:`Decimal.from_number() <decimal.Decimal.from_number>`.
|
:meth:`Decimal.from_number() <decimal.Decimal.from_number>`.
|
||||||
(Contributed by Serhiy Storchaka in :gh:`121798`.)
|
(Contributed by Serhiy Storchaka in :gh:`121798`.)
|
||||||
|
|
||||||
|
difflib
|
||||||
|
-------
|
||||||
|
|
||||||
|
* Comparison pages with highlighted changes generated by the
|
||||||
|
:class:`difflib.HtmlDiff` class now support dark mode.
|
||||||
|
(Contributed by Jiahao Li in :gh:`129939`.)
|
||||||
|
|
||||||
dis
|
dis
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1632,13 +1632,22 @@ _file_template = """
|
||||||
</html>"""
|
</html>"""
|
||||||
|
|
||||||
_styles = """
|
_styles = """
|
||||||
|
:root {color-scheme: light dark}
|
||||||
table.diff {font-family:Courier; border:medium;}
|
table.diff {font-family:Courier; border:medium;}
|
||||||
.diff_header {background-color:#e0e0e0}
|
.diff_header {background-color:#e0e0e0}
|
||||||
td.diff_header {text-align:right}
|
td.diff_header {text-align:right}
|
||||||
.diff_next {background-color:#c0c0c0}
|
.diff_next {background-color:#c0c0c0}
|
||||||
.diff_add {background-color:#aaffaa}
|
.diff_add {background-color:palegreen}
|
||||||
.diff_chg {background-color:#ffff77}
|
.diff_chg {background-color:#ffff77}
|
||||||
.diff_sub {background-color:#ffaaaa}"""
|
.diff_sub {background-color:#ffaaaa}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.diff_header {background-color:#666}
|
||||||
|
.diff_next {background-color:#393939}
|
||||||
|
.diff_add {background-color:darkgreen}
|
||||||
|
.diff_chg {background-color:#847415}
|
||||||
|
.diff_sub {background-color:darkred}
|
||||||
|
}"""
|
||||||
|
|
||||||
_table_template = """
|
_table_template = """
|
||||||
<table class="diff" id="difflib_chg_%(prefix)s_top"
|
<table class="diff" id="difflib_chg_%(prefix)s_top"
|
||||||
|
|
|
@ -9,13 +9,22 @@
|
||||||
content="text/html; charset=utf-8" />
|
content="text/html; charset=utf-8" />
|
||||||
<title></title>
|
<title></title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
:root {color-scheme: light dark}
|
||||||
table.diff {font-family:Courier; border:medium;}
|
table.diff {font-family:Courier; border:medium;}
|
||||||
.diff_header {background-color:#e0e0e0}
|
.diff_header {background-color:#e0e0e0}
|
||||||
td.diff_header {text-align:right}
|
td.diff_header {text-align:right}
|
||||||
.diff_next {background-color:#c0c0c0}
|
.diff_next {background-color:#c0c0c0}
|
||||||
.diff_add {background-color:#aaffaa}
|
.diff_add {background-color:palegreen}
|
||||||
.diff_chg {background-color:#ffff77}
|
.diff_chg {background-color:#ffff77}
|
||||||
.diff_sub {background-color:#ffaaaa}
|
.diff_sub {background-color:#ffaaaa}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.diff_header {background-color:#666}
|
||||||
|
.diff_next {background-color:#393939}
|
||||||
|
.diff_add {background-color:darkgreen}
|
||||||
|
.diff_chg {background-color:#847415}
|
||||||
|
.diff_sub {background-color:darkred}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Comparison pages with highlighted changes generated by the
|
||||||
|
:class:`difflib.HtmlDiff` class now support dark mode.
|
Loading…
Add table
Add a link
Reference in a new issue