Skip to content

Commit 364321f

Browse files
committed
Automatically apply v4 colors in template_defaults future mode
1 parent cde5358 commit 364321f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

plotly/io/_templates.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
import json
99
from functools import reduce
1010

11+
from six import string_types
12+
13+
from _plotly_future_ import _future_flags
14+
1115
try:
1216
from math import gcd
1317
except ImportError:
@@ -33,7 +37,8 @@ def __init__(self):
3337
# Initialize built-in templates
3438
default_templates = ['ggplot2', 'seaborn',
3539
'plotly', 'plotly_white',
36-
'plotly_dark', 'presentation', 'xgridoff']
40+
'plotly_dark', 'presentation', 'xgridoff',
41+
'plotly_v4_colors']
3742

3843
for template_name in default_templates:
3944
self._templates[template_name] = Lazy
@@ -62,6 +67,14 @@ def __getitem__(self, item):
6267
template_str = pkgutil.get_data('plotly', path).decode('utf-8')
6368
template_dict = json.loads(template_str)
6469
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+
6578
self._templates[item] = template
6679

6780
return template

0 commit comments

Comments
 (0)