Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified example.pdf
Binary file not shown.
3 changes: 3 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

# Create a report
pdf = report.Report(output='example.pdf')

pdf.set_title('Gilfoyle example')
pdf.set_accent_background_color('#9f85ca')
pdf.set_accent_font_color('#fff')

# Create an empty payload
payload = pdf.get_payload()
Expand Down
8 changes: 4 additions & 4 deletions gilfoyle/assets/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ body {
}

.chapter{
background:#32B5C9;
color: #ffffff;
/* background:#32B5C9;*/
/* color: #ffffff;*/
}
.chapter h1{
font-weight: bold;
Expand All @@ -38,8 +38,8 @@ body {
align-items: initial !important;
}
.level-item{
background-color: #32B5C9;
color: #fff;
/*background-color: #32B5C9;*/
/*color: #fff;*/
padding-top: 30px;
padding-bottom: 30px;
}
Expand Down
9 changes: 8 additions & 1 deletion gilfoyle/assets/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>
<title>{{ report.title }}</title>
<link href="https://fonts.googleapis.com/css?family=Fira+Sans" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/bulma@0.9.0/css/bulma.min.css" />
<style>
{% include 'assets/css/default.css' %}

.chapter{background: {{report.accent_background_color}};}
.level-item{background-color: {{report.accent_background_color}};}

.chapter{color: {{report.accent_font_color}};}
.level-item{color: {{report.accent_font_color}};}

</style>

</head>
Expand Down
20 changes: 19 additions & 1 deletion gilfoyle/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def __init__(self,
self.base_url = base_url
self.payload = ''
self.title = ''
self.accent_background_color = ''
self.accent_font_color = ''

"""
Report configuration
Expand All @@ -26,6 +28,18 @@ def __init__(self,
def set_title(self, title):
self.title = title

def set_accent_background_color(self, accent_background_color):
if accent_background_color:
self.accent_background_color = accent_background_color
else:
self.accent_background_color = '#32B5C9'

def set_accent_font_color(self, accent_font_color):
if accent_font_color:
self.accent_font_color = accent_font_color
else:
self.accent_font_color = '#FFFFFF'

"""
Add pages
"""
Expand Down Expand Up @@ -146,6 +160,9 @@ def _extend_payload(self, payload):
"""

payload['report']['title'] = self.title
payload['report']['accent_background_color'] = self.accent_background_color
payload['report']['accent_font_color'] = self.accent_font_color

return payload

"""
Expand All @@ -159,7 +176,7 @@ def to_html(html, filename):
Args:
html: string of HTML.
filename: filename and path.

cl
Returns:
File.
"""
Expand All @@ -185,6 +202,7 @@ def create_report(self, payload, output='pdf', verbose=False):
"""

payload = self._extend_payload(payload)

if verbose:
print(payload)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
setup(
name='gilfoyle',
packages=['gilfoyle'],
version='0.914',
version='0.915',
license='MIT',
description='Gilfoyle is a Python-based report generator for data scientists who use Pandas.',
long_description=long_description,
Expand Down