Skip to content

Commit e306d1c

Browse files
committed
template-safe axis default color inheritance logic
there may be other similar logic we need to update for templates, but these are the most readily apparent ones
1 parent 8525953 commit e306d1c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/plots/cartesian/axis_defaults.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
6969
var dfltColor = coerce('color');
7070
// if axis.color was provided, use it for fonts too; otherwise,
7171
// inherit from global font color in case that was provided.
72-
var dfltFontColor = (dfltColor === containerIn.color) ? dfltColor : font.color;
72+
// Compare to dflt rather than to containerIn, so we can provide color via
73+
// template too.
74+
var dfltFontColor = (dfltColor !== layoutAttributes.color.dflt) ? dfltColor : font.color;
7375
// try to get default title from splom trace, fallback to graph-wide value
7476
var dfltTitle = ((layoutOut._splomAxes || {})[letter] || {})[id] || layoutOut._dfltTitle[letter];
7577

src/plots/cartesian/tick_label_defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
2727
var font = options.font || {};
2828
// as with titlefont.color, inherit axis.color only if one was
2929
// explicitly provided
30-
var dfltFontColor = (containerOut.color === containerIn.color) ?
30+
var dfltFontColor = (containerOut.color !== layoutAttributes.color.dflt) ?
3131
containerOut.color : font.color;
3232
Lib.coerceFont(coerce, 'tickfont', {
3333
family: font.family,

src/plots/ternary/layout/axis_defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option
2525
var dfltColor = coerce('color');
2626
// if axis.color was provided, use it for fonts too; otherwise,
2727
// inherit from global font color in case that was provided.
28-
var dfltFontColor = (dfltColor === containerIn.color) ? dfltColor : options.font.color;
28+
var dfltFontColor = (dfltColor !== layoutAttributes.color.dflt) ? dfltColor : options.font.color;
2929

3030
var axName = containerOut._name,
3131
letterUpper = axName.charAt(0).toUpperCase(),

0 commit comments

Comments
 (0)