How to change color of Icon which make from createFromIconfontCN with Ant Design?

3.8k Views Asked by At

I want to change color of Icon which make by function **createFromIconfontCN** of ant-design icons tool, but I can't find the way to customize it.
Is there any way to change its color ?

Here is my code:

import { createFromIconfontCN } from '@ant-design/icons';

const IconFont = createFromIconfontCN({
  scriptUrl: '//at.alicdn.com/t/font_1920998_qwtyc6g5q7f.js',
});

ReactDOM.render(
  <div>
    <IconFont type="iconright"></IconFont>
  </div>,
  mountNode,
);

You can check it out here:
https://ant.design/components/icon/
Section: **Use iconfont.cn**

Thank you!

1

There are 1 best solutions below

0
Apostolos On BEST ANSWER

If you include a style property with the color you want, it changes the color.

<IconFont type="iconright" style={{ color: "green" }} />

check this sandbox