diff --git a/components/badge/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/badge/__tests__/__snapshots__/demo-extend.test.ts.snap
index 03cfd35a1b..88077d5007 100644
--- a/components/badge/__tests__/__snapshots__/demo-extend.test.ts.snap
+++ b/components/badge/__tests__/__snapshots__/demo-extend.test.ts.snap
@@ -627,531 +627,759 @@ Array [
`;
exports[`renders components/badge/demo/colorful-with-count-debug.tsx extend context correctly 1`] = `
-
+Array [
-
-
- pink
-
-
-
+ pink
+
+
- 4
+
+ 4
+
-
-
+
+ 4
+
+
+
+
+
+
+
+
+ red
+
+
- 4
+
+ 4
+
-
-
-
-
+
+
+ 4
+
+
+
+
+
+
+
+
+ yellow
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ orange
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ cyan
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ green
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ blue
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ purple
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ geekblue
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ magenta
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ volcano
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ gold
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ lime
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+ ,
-
-
- red
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-pink"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- yellow
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-red"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- orange
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-yellow"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- cyan
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-orange"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- green
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-cyan"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- blue
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-green"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- purple
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-blue"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- geekblue
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-purple"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- magenta
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-geekblue"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- volcano
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-magenta"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- gold
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-volcano"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- lime
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-gold"
+ />
-
- 4
-
+ loading
-
-
-
-
+
+
+
+
+
+
+ loading
+
+
+
+ ,
+]
`;
exports[`renders components/badge/demo/dot.tsx extend context correctly 1`] = `
diff --git a/components/badge/__tests__/__snapshots__/demo.test.ts.snap b/components/badge/__tests__/__snapshots__/demo.test.ts.snap
index 52a4a358e9..1189cbb6a0 100644
--- a/components/badge/__tests__/__snapshots__/demo.test.ts.snap
+++ b/components/badge/__tests__/__snapshots__/demo.test.ts.snap
@@ -628,531 +628,759 @@ Array [
`;
exports[`renders components/badge/demo/colorful-with-count-debug.tsx correctly 1`] = `
-
+Array [
-
-
- pink
-
-
-
+ pink
+
+
- 4
+
+ 4
+
-
-
+
+ 4
+
+
+
+
+
+
+
+
+ red
+
+
- 4
+
+ 4
+
-
-
-
-
+
+
+ 4
+
+
+
+
+
+
+
+
+ yellow
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ orange
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ cyan
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ green
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ blue
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ purple
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ geekblue
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ magenta
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ volcano
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ gold
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+ lime
+
+
+
+
+ 4
+
+
+
+
+ 4
+
+
+
+
+
+ ,
-
-
- red
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-pink"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- yellow
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-red"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- orange
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-yellow"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- cyan
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-orange"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- green
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-cyan"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- blue
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-green"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- purple
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-blue"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- geekblue
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-purple"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- magenta
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-geekblue"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- volcano
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-magenta"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- gold
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-volcano"
+ />
-
- 4
-
+ loading
-
-
-
-
-
+
+
-
- lime
-
-
-
- 4
-
-
+ class="ant-badge-status-dot ant-badge-status-processing ant-badge-color-gold"
+ />
-
- 4
-
+ loading
-
-
-
-
+
+
+
+
+
+
+ loading
+
+
+
+ ,
+]
`;
exports[`renders components/badge/demo/dot.tsx correctly 1`] = `
diff --git a/components/badge/demo/colorful-with-count-debug.tsx b/components/badge/demo/colorful-with-count-debug.tsx
index 5d0084337d..c659056ece 100644
--- a/components/badge/demo/colorful-with-count-debug.tsx
+++ b/components/badge/demo/colorful-with-count-debug.tsx
@@ -1,5 +1,5 @@
-import React from 'react';
import { Badge, Space } from 'antd';
+import React from 'react';
const colors = [
'pink',
@@ -17,24 +17,35 @@ const colors = [
'lime',
];
+const AvatarItem = ({ color }: { color: string }) => (
+
+ {color}
+
+);
+
const App: React.FC = () => (
-
- {colors.map((color) => (
-
-
- {color}
-
-
- ))}
-
+ <>
+
+ {colors.map((color) => (
+
+
+
+ ))}
+
+
+ {colors.map((color) => (
+
+ ))}
+
+ >
);
export default App;
diff --git a/components/badge/style/index.ts b/components/badge/style/index.ts
index f474ee2da9..3c1a276039 100644
--- a/components/badge/style/index.ts
+++ b/components/badge/style/index.ts
@@ -74,8 +74,11 @@ const genSharedBadgeStyle: GenerateStyle = (token: BadgeToken): CSSO
const ribbonWrapperPrefixCls = `${antCls}-ribbon-wrapper`;
const colorPreset = genPresetColor(token, (colorKey, { darkColor }) => ({
- [`${componentCls}-color-${colorKey}`]: {
+ [`&${componentCls} ${componentCls}-color-${colorKey}`]: {
background: darkColor,
+ [`&:not(${componentCls}-count)`]: {
+ color: darkColor,
+ },
},
}));