@@ -360,25 +360,50 @@ def preview(self):
360360 ' ' .join ([templates [f ] % ('*' + f if f in rel .primary_key else f ) for f in columns ]) + '\n ' +
361361 ' ' .join (['+' + '-' * (widths [column ] - 2 ) + '+' for column in columns ]) + '\n ' +
362362 '\n ' .join (' ' .join (templates [f ] % tup [f ] for f in columns ) for tup in tuples ) +
363- ('\n ...\n ' if len (rel ) > limit else '\n ' ) +
363+ ('\n ...\n ' if len (rel ) > limit else '\n ' ) +
364364 ' (%d tuples)\n ' % len (rel ))
365365
366366 def _repr_html_ (self ):
367367 rel = self .proj (* self .heading .non_blobs ,
368368 ** dict (zip_longest (self .heading .blobs , [], fillvalue = "'=BLOB='" ))) # replace blobs with =BLOB=
369369 info = self .heading .table_info
370370 count = len (rel )
371- return """ {title}
371+
372+ css = """
373+ <style type="text/css">
374+ .Relation{
375+ border-collapse:collapse;
376+ }
377+ .Relation th{
378+ background: #A0A0A0; color: #ffffff; padding:4px; border:#f0e0e0 1px solid;
379+ font-weight: normal; font-family: monospace; font-size: 75%;
380+ }
381+ .Relation td{
382+ padding:4px; border:#f0e0e0 1px solid; font-size:75%;
383+ }
384+ .Relation tr:nth-child(odd){
385+ background: #ffffff;
386+ }
387+ .Relation tr:nth-child(even){
388+ background: #f3f1ff;
389+ }
390+ </style>
391+ """
392+
393+ return """
394+ {css}
395+ {title}
372396 <div style="max-height:1000px;max-width:1500px;overflow:auto;">
373- <table border="1" class="dataframe ">
397+ <table border="1" class="Relation ">
374398 <thead> <tr style="text-align: right;"> <th> {head} </th> </tr> </thead>
375399 <tbody> <tr> {body} </tr> </tbody>
376400 </table>
377401 {ellipsis}
378402 <p>{count} tuples</p></div>
379403 """ .format (
380- title = "" if info is None else "<h3>%s</h3>" % info ['comment' ],
381- head = '</th><th>' .join ("<em>" + c + "</em>" if c in self .primary_key else c
404+ css = css ,
405+ title = "" if info is None else "<b>%s</b>" % info ['comment' ],
406+ head = '</th><th>' .join ('<b><font color="black">' + c + "</font></b>" if c in self .primary_key else c
382407 for c in rel .heading .names ),
383408 ellipsis = '<p>...</p>' if count > config ['display.limit' ] else '' ,
384409 body = '</tr><tr>' .join (
0 commit comments