@@ -159,7 +159,7 @@ def __init__(
159
159
color_system : Optional [
160
160
Literal ["auto" , "standard" , "256" , "truecolor" ]
161
161
] = "auto" ,
162
- styles : Dict [str , Style ] = DEFAULT_STYLES ,
162
+ styles : Dict [str , Style ] = None ,
163
163
file : IO = None ,
164
164
width : int = None ,
165
165
height : int = None ,
@@ -170,7 +170,7 @@ def __init__(
170
170
log_time_format : str = "[%X] " ,
171
171
):
172
172
173
- self ._styles = ChainMap (styles )
173
+ self ._styles = ChainMap (DEFAULT_STYLES if styles is None else styles )
174
174
self .file = file or sys .stdout
175
175
self ._width = width
176
176
self ._height = height
@@ -249,7 +249,7 @@ def is_terminal(self) -> bool:
249
249
250
250
Returns:
251
251
bool: True if the console writting to a device capable of
252
- understanding terminal codes, otherwise False.
252
+ understanding terminal codes, otherwise False.
253
253
"""
254
254
isatty = getattr (self .file , "isatty" , None )
255
255
return False if isatty is None else isatty ()
@@ -722,7 +722,7 @@ def export_html(
722
722
self ,
723
723
theme : Theme = None ,
724
724
clear : bool = True ,
725
- code_format = CONSOLE_HTML_FORMAT ,
725
+ code_format : str = None ,
726
726
inline_styles : bool = False ,
727
727
) -> str :
728
728
"""Generate HTML from console contents (requires record=True argument in constructor).
@@ -747,6 +747,8 @@ def export_html(
747
747
_theme = theme or themes .DEFAULT
748
748
stylesheet = ""
749
749
750
+ render_code_format = CONSOLE_HTML_FORMAT if code_format is None else code_format
751
+
750
752
if inline_styles :
751
753
for text , style in Segment .simplify (self ._record_buffer ):
752
754
if style :
@@ -773,7 +775,7 @@ def export_html(
773
775
stylesheet_append (f".r{ style_number } {{{ style_rule } }}" )
774
776
stylesheet = "\n " .join (stylesheet_rules )
775
777
776
- rendered_code = code_format .format (
778
+ rendered_code = render_code_format .format (
777
779
code = "" .join (fragments ),
778
780
stylesheet = stylesheet ,
779
781
foreground = _theme .foreground_color .hex ,
0 commit comments