To change the colors of the designer, the most efficient way is to apply your own styles from an external CSS file, however, a quick way is to go through the plugin to define the colors of the different elements of the designer.

To define the theme, you just have to add the object containing its configuration directly to the default options when the plugin is initialized :

var options = {
	theme : {...}
}

var instance = new AsukaDesigner('#myId');

Here is an example configuration which will define all the possible styles, you can omit the properties that you don’t need to change :

{
	canvas: '#fff',
	container: '#f7f7f7',
	menu: {
		color: '#000000a6',
		background: '#fff',
		hoverColor: '#1890ff',
		activeColor: '#1890ff',
		hoverBackgroundColor: 'transparent',
		activeBackgroundColor: '#e6f7ff',
		border: '#f0f0f0',
	},
	panel: {
		color: '#000000a6',
		background: '#fff',
	},
	modal: {
		color: '#000000a6',
		background: '#fff',
		border: '#f0f0f0',
	},
	popover: {
		color: '#000000a6',
		background: '#fff',
		border: '#f0f0f0',
	},
	drawer: {
		color: '#000000a6',
		background: '#fff',
		border: '#f0f0f0',
	},
	primary: {
		background: '#1890ff',
		border: '#1890ff',
		color: '#fff',
		hoverColor: '#fff',
		hoverBackgroundColor: 'transparent',
		hoverBorderColor: 'transparent',
	},
	secondary: {
		color: '#000000a6',
		background: '#fff',
		border: '#f0f0f0',
		hoverColor: '#40a9ff',
		hoverBackgroundColor: '#40a9ff',
		hoverBorderColor: '#40a9ff',
	},
	tertiary: {
		color: '#000000a6',
		background: '#f9f9f9',
		border: '#f9f9f9',
		hoverColor: '#40a9ff',
		hoverBackgroundColor: '#f9f9f9',
		hoverBorderColor: '#f9f9f9',
	},
	card: {
		color: '#000000a6',
		background: '#fff',
		border: '#f0f0f0',
		hoverColor: '#40a9ff',
		hoverBackgroundColor: '#40a9ff',
		hoverBorderColor: '#40a9ff',
	}
}

Thanks to the API, you can also modify the colors of the designer after its initialization :

var instance = new AsukaDesigner('#myId');

instance.layout().setColor('canvas', 'purple');
instance.layout().setColor('menu', {
	color: 'orange',
	background: 'red',
});

// Ugly theming right here

Was this article helpful to you? Yes No

How can we help?