Patchwork [V2] hgweb: ensure both foreground and background colors are specified (issue4872)

login
register
mail settings
Submitter Gijs Kruitbosch
Date Oct. 8, 2015, 5:19 p.m.
Message ID <ea1835520027061850dd.1444324771@gkruitbosch-16516.local>
Download mbox | patch
Permalink /patch/10879/
State Accepted
Headers show

Comments

Gijs Kruitbosch - Oct. 8, 2015, 5:19 p.m.
# HG changeset patch
# User Gijs Kruitbosch <gijskruitbosch@gmail.com>
# Date 1444248494 -3600
#      Wed Oct 07 21:08:14 2015 +0100
# Node ID ea1835520027061850ddc9faf5e9394ba0f32833
# Parent  3f234db6fe8d7cc3d39083f7e7523444bc21e5a2
hgweb: ensure both foreground and background colors are specified (issue4872)
When users configure the default foreground or background color to non-default (black on white) values, several hgweb styles lack contrast for headers and table row items. This patch fixes that by ensuring that where either foreground or background colors are specified, both are specified.
Augie Fackler - Oct. 8, 2015, 5:50 p.m.
On Thu, Oct 08, 2015 at 06:19:31PM +0100, Gijs Kruitbosch wrote:
> # HG changeset patch
> # User Gijs Kruitbosch <gijskruitbosch@gmail.com>
> # Date 1444248494 -3600
> #      Wed Oct 07 21:08:14 2015 +0100
> # Node ID ea1835520027061850ddc9faf5e9394ba0f32833
> # Parent  3f234db6fe8d7cc3d39083f7e7523444bc21e5a2
> hgweb: ensure both foreground and background colors are specified (issue4872)

queued, thanks


> When users configure the default foreground or background color to non-default (black on white) values, several hgweb styles lack contrast for headers and table row items. This patch fixes that by ensuring that where either foreground or background colors are specified, both are specified.
>
> diff --git a/mercurial/templates/static/style-gitweb.css b/mercurial/templates/static/style-gitweb.css
> --- a/mercurial/templates/static/style-gitweb.css
> +++ b/mercurial/templates/static/style-gitweb.css
> @@ -1,11 +1,11 @@
> -body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; }
> +body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
>  a { color:#0000cc; }
>  a:hover, a:visited, a:active { color:#880000; }
>  div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
>  div.page_header a:visited { color:#0000cc; }
>  div.page_header a:hover { color:#880000; }
>  div.page_nav { padding:8px; }
>  div.page_nav a:visited { color:#0000cc; }
>  div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
>  div.page_footer { padding:4px 8px; background-color: #d9d8d1; }
>  div.page_footer_text { float:left; color:#555555; font-style:italic; }
> diff --git a/mercurial/templates/static/style-paper.css b/mercurial/templates/static/style-paper.css
> --- a/mercurial/templates/static/style-paper.css
> +++ b/mercurial/templates/static/style-paper.css
> @@ -1,14 +1,15 @@
>  body {
>    margin: 0;
>    padding: 0;
>    background: white;
> +  color: black;
>    font-family: sans-serif;
>  }
>
>  .container {
>    padding-left: 115px;
>  }
>
>  .main {
>    position: relative;
>    background: white;
> diff --git a/mercurial/templates/static/style.css b/mercurial/templates/static/style.css
> --- a/mercurial/templates/static/style.css
> +++ b/mercurial/templates/static/style.css
> @@ -1,16 +1,16 @@
>  a { text-decoration:none; }
>  .age { white-space:nowrap; }
>  .date { white-space:nowrap; }
>  .indexlinks { white-space:nowrap; }
> -.parity0 { background-color: #ddd; }
> -.parity1 { background-color: #eee; }
> +.parity0 { background-color: #ddd; color: #000; }
> +.parity1 { background-color: #eee; color: #000; }
>  .lineno { width: 60px; color: #aaa; font-size: smaller;
>            text-align: right; }
>  .plusline { color: green; }
>  .minusline { color: red; }
>  .atline { color: purple; }
>  .annotate { font-size: smaller; text-align: right; padding-right: 1em; }
>  .buttons a {
>    background-color: #666;
>    padding: 2pt;
>    color: white;
> diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t
> +++ b/tests/test-hgweb-commands.t
> @@ -1937,22 +1937,22 @@ failing unbundle, requires POST request
>
>  Static files
>
>    $ get-with-headers.py 127.0.0.1:$HGPORT 'static/style.css'
>    200 Script output follows
>
>    a { text-decoration:none; }
>    .age { white-space:nowrap; }
>    .date { white-space:nowrap; }
>    .indexlinks { white-space:nowrap; }
> -  .parity0 { background-color: #ddd; }
> -  .parity1 { background-color: #eee; }
> +  .parity0 { background-color: #ddd; color: #000; }
> +  .parity1 { background-color: #eee; color: #000; }
>    .lineno { width: 60px; color: #aaa; font-size: smaller;
>              text-align: right; }
>    .plusline { color: green; }
>    .minusline { color: red; }
>    .atline { color: purple; }
>    .annotate { font-size: smaller; text-align: right; padding-right: 1em; }
>    .buttons a {
>      background-color: #666;
>      padding: 2pt;
>      color: white;
> diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
> --- a/tests/test-hgweb.t
> +++ b/tests/test-hgweb.t
> @@ -333,24 +333,24 @@ stop and restart
>
>  Test the access/error files are opened in append mode
>
>    $ $PYTHON -c "print len(file('access.log').readlines()), 'log lines written'"
>    14 log lines written
>
>  static file
>
>    $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
>    200 Script output follows
> -  content-length: 6379
> +  content-length: 6412
>    content-type: text/css
>
> -  body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; }
> +  body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
>    a { color:#0000cc; }
>    a:hover, a:visited, a:active { color:#880000; }
>    div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
>    div.page_header a:visited { color:#0000cc; }
>    div.page_header a:hover { color:#880000; }
>    div.page_nav { padding:8px; }
>    div.page_nav a:visited { color:#0000cc; }
>    div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
>    div.page_footer { padding:4px 8px; background-color: #d9d8d1; }
>    div.page_footer_text { float:left; color:#555555; font-style:italic; }
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/templates/static/style-gitweb.css b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -1,11 +1,11 @@ 
-body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; }
+body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
 a { color:#0000cc; }
 a:hover, a:visited, a:active { color:#880000; }
 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
 div.page_header a:visited { color:#0000cc; }
 div.page_header a:hover { color:#880000; }
 div.page_nav { padding:8px; }
 div.page_nav a:visited { color:#0000cc; }
 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
 div.page_footer { padding:4px 8px; background-color: #d9d8d1; }
 div.page_footer_text { float:left; color:#555555; font-style:italic; }
diff --git a/mercurial/templates/static/style-paper.css b/mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css
+++ b/mercurial/templates/static/style-paper.css
@@ -1,14 +1,15 @@ 
 body {
   margin: 0;
   padding: 0;
   background: white;
+  color: black;
   font-family: sans-serif;
 }
 
 .container {
   padding-left: 115px;
 }
 
 .main {
   position: relative;
   background: white;
diff --git a/mercurial/templates/static/style.css b/mercurial/templates/static/style.css
--- a/mercurial/templates/static/style.css
+++ b/mercurial/templates/static/style.css
@@ -1,16 +1,16 @@ 
 a { text-decoration:none; }
 .age { white-space:nowrap; }
 .date { white-space:nowrap; }
 .indexlinks { white-space:nowrap; }
-.parity0 { background-color: #ddd; }
-.parity1 { background-color: #eee; }
+.parity0 { background-color: #ddd; color: #000; }
+.parity1 { background-color: #eee; color: #000; }
 .lineno { width: 60px; color: #aaa; font-size: smaller;
           text-align: right; }
 .plusline { color: green; }
 .minusline { color: red; }
 .atline { color: purple; }
 .annotate { font-size: smaller; text-align: right; padding-right: 1em; }
 .buttons a {
   background-color: #666;
   padding: 2pt;
   color: white;
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -1937,22 +1937,22 @@  failing unbundle, requires POST request
 
 Static files
 
   $ get-with-headers.py 127.0.0.1:$HGPORT 'static/style.css'
   200 Script output follows
   
   a { text-decoration:none; }
   .age { white-space:nowrap; }
   .date { white-space:nowrap; }
   .indexlinks { white-space:nowrap; }
-  .parity0 { background-color: #ddd; }
-  .parity1 { background-color: #eee; }
+  .parity0 { background-color: #ddd; color: #000; }
+  .parity1 { background-color: #eee; color: #000; }
   .lineno { width: 60px; color: #aaa; font-size: smaller;
             text-align: right; }
   .plusline { color: green; }
   .minusline { color: red; }
   .atline { color: purple; }
   .annotate { font-size: smaller; text-align: right; padding-right: 1em; }
   .buttons a {
     background-color: #666;
     padding: 2pt;
     color: white;
diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
--- a/tests/test-hgweb.t
+++ b/tests/test-hgweb.t
@@ -333,24 +333,24 @@  stop and restart
 
 Test the access/error files are opened in append mode
 
   $ $PYTHON -c "print len(file('access.log').readlines()), 'log lines written'"
   14 log lines written
 
 static file
 
   $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
   200 Script output follows
-  content-length: 6379
+  content-length: 6412
   content-type: text/css
   
-  body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; }
+  body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
   a { color:#0000cc; }
   a:hover, a:visited, a:active { color:#880000; }
   div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
   div.page_header a:visited { color:#0000cc; }
   div.page_header a:hover { color:#880000; }
   div.page_nav { padding:8px; }
   div.page_nav a:visited { color:#0000cc; }
   div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
   div.page_footer { padding:4px 8px; background-color: #d9d8d1; }
   div.page_footer_text { float:left; color:#555555; font-style:italic; }