The alert component of antd cannot customize styles.

  1. my project development environment is antd + dva + umi. When using antd, it is convenient to customize the style by overriding the less variable in the custom theme. But today I found that the Alert component can"t easily customize the style (foreground color, background color).
  2. theme.js related code is as follows
{
    "@primary-color": "-sharp3a377d",
    "@link-color": "-sharp3a377d",
    "@popover-bg": "-sharp37777d",
    "@border-radius-base": "0px",
    "@popover-color": "-sharpfff",
    "@info-color": "-sharp393a7a",
    "@alert-message-color": "-sharpfff",
    "@alert-text-color": "-sharpfff",
}

3. The actual effect is shown in the figure. The background color is not the color I specified, but a variation generated by antd calling a colorPalette function, and the foreground color has no effect at all.

would you like to ask if you have a good way to customize the alert style? Thank you!

Apr.01,2021
Menu