2018-08-30 22:53:24 +08:00
|
|
|
---
|
|
|
|
order: 1
|
|
|
|
title:
|
|
|
|
zh-CN: 多色图标
|
|
|
|
en-US: Two-tone icon and colorful icon
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2018-08-31 11:14:51 +08:00
|
|
|
可以通过设置 `theme` 属性为 `twoTone` 来渲染双色图标,并且可以设置全局性的主题色。
|
2018-08-30 22:53:24 +08:00
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2018-08-31 11:14:51 +08:00
|
|
|
Specific them property `theme` to `twoTone` to render two-tone icons. You can also set the primary color globally.
|
2018-08-30 22:53:24 +08:00
|
|
|
|
|
|
|
````jsx
|
|
|
|
import { Icon } from 'antd';
|
|
|
|
|
2018-08-31 10:53:03 +08:00
|
|
|
Icon.setTwoToneColors({
|
|
|
|
primaryColor: '#1890ff',
|
|
|
|
});
|
2018-08-30 22:53:24 +08:00
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<div className="icons-list">
|
2018-08-31 11:14:51 +08:00
|
|
|
<Icon type="dollar" theme="twoTone" />
|
|
|
|
<Icon type="euro" theme="twoTone" />
|
|
|
|
<Icon type="check-circle" theme="twoTone" primaryColor="#f5222d" />
|
2018-08-30 22:53:24 +08:00
|
|
|
</div>,
|
|
|
|
mountNode
|
|
|
|
);
|
|
|
|
````
|
|
|
|
|
|
|
|
```css
|
|
|
|
.icons-list > .anticon {
|
|
|
|
margin-right: 6px;
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
```
|