Download this file

25 lines (16 with data), 523 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def style_str(s, color='black', weight=300):
"""
Style the supplied string with HTML tags
Args:
s (str):
string to format
color( str ):
color to show the string in
weight( int ):
how thick the string will be displayed
Returns:
html(string) : html representation of the string
"""
return f'<text style="color:{color}; font-weight:{weight}" >{s}</text>'