8
8
import json
9
9
from functools import reduce
10
10
11
+ from six import string_types
12
+
13
+ from _plotly_future_ import _future_flags
14
+
11
15
try :
12
16
from math import gcd
13
17
except ImportError :
@@ -33,7 +37,8 @@ def __init__(self):
33
37
# Initialize built-in templates
34
38
default_templates = ['ggplot2' , 'seaborn' ,
35
39
'plotly' , 'plotly_white' ,
36
- 'plotly_dark' , 'presentation' , 'xgridoff' ]
40
+ 'plotly_dark' , 'presentation' , 'xgridoff' ,
41
+ 'plotly_v4_colors' ]
37
42
38
43
for template_name in default_templates :
39
44
self ._templates [template_name ] = Lazy
@@ -62,6 +67,14 @@ def __getitem__(self, item):
62
67
template_str = pkgutil .get_data ('plotly' , path ).decode ('utf-8' )
63
68
template_dict = json .loads (template_str )
64
69
template = Template (template_dict )
70
+
71
+ if ('template_defaults' in _future_flags
72
+ and isinstance (item , string_types )
73
+ and item in ('plotly' , 'plotly_white' , 'plotly_dark' )
74
+ ):
75
+ template = self .merge_templates (
76
+ template , self ['plotly_v4_colors' ])
77
+
65
78
self ._templates [item ] = template
66
79
67
80
return template
0 commit comments