And this patch does it with hardcoded header, and row colors, with a custom
text color in the header.

msoulier@anton:...es/sphinx/writers$ diff -u latex.py.orig latex.py
--- latex.py.orig   2011-08-02 08:38:24.000000000 -0400
+++ latex.py    2011-08-02 08:56:21.000000000 -0400
@@ -48,6 +48,11 @@
 \newcommand{\sphinxlogo}{%(logo)s}
 \renewcommand{\releasename}{%(releasename)s}
 %(makeindex)s
+\usepackage{color}
+\usepackage{colortbl}
+\definecolor{tableheader}{rgb}{0,0,1}
+\definecolor{row1}{rgb}{0.7,0.7,0.7}
+\definecolor{row2}{rgb}{0.9,0.9,0.9}
 '''
 
 BEGIN_DOC = r'''
@@ -712,6 +717,12 @@
         self.body.append('\\hline\n')
 
     def visit_row(self, node):
+        if self.table.rowcount == 0:
+            self.body.append('\\rowcolor{tableheader}\n')
+        elif self.table.rowcount % 2 == 0:
+            self.body.append('\\rowcolor{row1}\n')
+        else:
+            self.body.append('\\rowcolor{row2}\n')
         self.table.col = 0
     def depart_row(self, node):
         self.body.append('\\\\\n')
@@ -726,8 +737,8 @@
             self.body.append(' & ')
         self.table.col += 1
         if isinstance(node.parent.parent, nodes.thead):
-            self.body.append('\\textbf{')
-            self.context.append('}')
+            self.body.append('\\textcolor{white}{\\textbf{')
+            self.context.append('}}')
         else:
             self.context.append('')
     def depart_entry(self, node):


I don't want to maintain a patched latex writer though, so is there a chance
of putting such hooks into Sphinx?

Thanks,
mps

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to