Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/badge/demos/enUS/color.demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</markdown>

<template>
<n-badge value="15" color="grey">
<n-badge value="15" color="grey" text-color="yellow">
<n-avatar />
</n-badge>
</template>
2 changes: 1 addition & 1 deletion src/badge/demos/zhCN/color.demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</markdown>

<template>
<n-badge value="15" color="grey">
<n-badge value="15" color="grey" text-color="yellow">
<n-avatar />
</n-badge>
</template>
13 changes: 10 additions & 3 deletions src/badge/src/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const badgeProps = {
showZero: Boolean,
processing: Boolean,
color: String,
textColor: String,
offset: Array as unknown as PropType<
readonly [number | string, number | string]
>
Expand Down Expand Up @@ -78,18 +79,24 @@ export default defineComponent({

const rtlEnabledRef = useRtl('Badge', mergedRtlRef, mergedClsPrefixRef)
const cssVarsRef = computed(() => {
const { type, color: propColor } = props
const { type, color: propColor, textColor: propsTextColor } = props
const {
common: { cubicBezierEaseInOut, cubicBezierEaseOut },
self: { [createKey('color', type)]: color, fontFamily, fontSize }
self: {
[createKey('color', type)]: color,
fontFamily,
fontSize,
textColor
}
} = themeRef.value
return {
'--n-font-size': fontSize,
'--n-font-family': fontFamily,
'--n-color': propColor || color,
'--n-ripple-color': propColor || color,
'--n-bezier': cubicBezierEaseInOut,
'--n-ripple-bezier': cubicBezierEaseOut
'--n-ripple-bezier': cubicBezierEaseOut,
'--n-text-color': propsTextColor || textColor
}
})

Expand Down
2 changes: 1 addition & 1 deletion src/badge/src/styles/index.cssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default c([
transition:
background-color .3s var(--n-bezier),
color .3s var(--n-bezier);
color: #FFF;
color: var(--n-text-color);
position: absolute;
height: 18px;
line-height: 18px;
Expand Down
1 change: 1 addition & 0 deletions src/badge/styles/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const badgeDark: BadgeTheme = {
colorSuccess: successColorSuppl,
colorError: errorColorSuppl,
colorWarning: warningColorSuppl,
textColor: '#FFF',
fontSize: '12px',
fontFamily
}
Expand Down
1 change: 1 addition & 0 deletions src/badge/styles/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function self(vars: ThemeCommonVars) {
colorSuccess: successColor,
colorError: errorColor,
colorWarning: warningColor,
textColor: '#FFF',
fontSize: '12px',
fontFamily
}
Expand Down