可通过`editor.config.colors` `editor.config.familys` `editor.config.fontsizes` 三个配置项来配置编辑器的颜色(字体颜色、背景色),字体,字号。**该操作必须再`editor.create()`方法之前执行**
![](https://box.kancloud.cn/2016-01-29_56ab6d05af824.png)
代码示例:
```html
请输入内容...
var editor = new wangEditor('div1');
// 颜色
editor.config.colors = {
'#880000': '暗红色',
'#800080': '紫色',
'#ff0000': '红色'
};
// 字体
editor.config.familys = [
'宋体', '黑体', '楷体', '微软雅黑',
'Arial', 'Verdana', 'Georgia'
];
// 字号
editor.config.fontsizes = {
// 格式:'value': 'title'
1: '10px',
2: '13px',
3: '16px',
4: '19px',
5: '22px',
6: '25px',
7: '28px'
};
editor.create();
```
注意:字号的配置中,对象的`value`值必须是`1 2 3 4 5 6 7`这几个数字(全部或者选择其中几个),`title`可以自己修改。如:
```
// 字号
editor.config.fontsizes = {
// 格式:'value': 'title'
2: '小',
3: '中',
5: '大',
7: '特大'
};
```