cssreactjsantdant-design-proicon-fonts

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



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!


Solution

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

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

    check this sandbox