Skip to content

Commit

Permalink
Merge pull request #594 from yairVanti/generalize-report-fontfamily-f…
Browse files Browse the repository at this point in the history
…or-all-os

decide on font family dynamically
  • Loading branch information
pplonski authored Dec 14, 2022
2 parents 0e33b53 + b5aa879 commit de75b7a
Showing 1 changed file with 34 additions and 26 deletions.
60 changes: 34 additions & 26 deletions supervised/base_automl.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
check_integer,
)
from supervised.utils.utils import dump_data, load_data
import matplotlib.font_manager as font_manager

# Get a list of all font families available on the system
font_families = font_manager.findSystemFonts()

# Load the font file for the first font family in the list and get the name of the first font family
REPORT_FONT = font_manager.FontProperties(fname=font_families[0]).get_name()


logger = logging.getLogger(__name__)
logger.setLevel(LOG_LEVEL)
Expand Down Expand Up @@ -2046,68 +2054,68 @@ def from_json(self, json_data):

self._ml_task = json_data.get("ml_task")

report_style = """
.styled-table {
report_style = f"""
.styled-table {{
border-collapse: collapse;
font-size: 0.9em;
font-family:Courier New;
}
}}
.styled-table td, .styled-table th {
.styled-table td, .styled-table th {{
border: 1px solid #ddd;
padding: 8px;
}
{{
.styled-table tr:nth-child(even){background-color: #f2f2f2;}
.styled-table tr:nth-child(even){{background-color: #f2f2f2;}}
.styled-table tr:hover {background-color: #e0ecf5;}
.styled-table tr:hover {{background-color: #e0ecf5;}}
.styled-table thead {
.styled-table thead {{
padding-top: 6px;
padding-bottom: 6px;
text-align: left;
background-color: #0099cc;
color: white;
}
}}
body {
font-family: Arial;
body {{
font-family: {REPORT_FONT};
font-size: 1.0em;
background-color: rgba(236, 243, 249, 0.15);
}
}}
h1 {
h1 {{
color: #004666;
border-bottom: 1px solid rgba(0,70,102,0.3)
}
h2 {
}}
h2 {{
color: #004666;
padding-bottom: 5px;
margin-bottom: 0px;
}
}}
ul {
ul {{
margin-top: 0px;
}
}}
p {
p {{
margin-top: 5px;
}
}}
h3 {
h3 {{
color: #004666;
padding-bottom: 5px;
margin-bottom: 0px;
}
a {
}}
a {{
font-weight: bold;
color: #004666;
}
}}
a:hover {
a:hover {{
cursor: pointer;
color: #0099CC;
}
}}
"""
Expand Down

0 comments on commit de75b7a

Please sign in to comment.