package.src.components.modebar.defaults.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plotly.js Show documentation
Show all versions of plotly.js Show documentation
The open source javascript graphing library that powers plotly
The newest version!
'use strict';
var Lib = require('../../lib');
var Color = require('../color');
var Template = require('../../plot_api/plot_template');
var attributes = require('./attributes');
module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {
var containerIn = layoutIn.modebar || {};
var containerOut = Template.newContainer(layoutOut, 'modebar');
function coerce(attr, dflt) {
return Lib.coerce(containerIn, containerOut, attributes, attr, dflt);
}
coerce('orientation');
coerce('bgcolor', Color.addOpacity(layoutOut.paper_bgcolor, 0.5));
var defaultColor = Color.contrast(Color.rgb(layoutOut.modebar.bgcolor));
coerce('color', Color.addOpacity(defaultColor, 0.3));
coerce('activecolor', Color.addOpacity(defaultColor, 0.7));
coerce('uirevision', layoutOut.uirevision);
coerce('add');
coerce('remove');
};