Skip to content

Commit

Permalink
fix(QRCode): Fix the issue where the background color and font color … (
Browse files Browse the repository at this point in the history
#47128)

* fix(QRCode): Fix the issue where the background color and font color of the QR code component do not synchronize with the theme in dark mode

* fix(QRCode): Update test snapshot

* fix(QRCode): Remove inline styles, adjust style handling, and regenerate test snapshots

* fix(QRCode): Fix the issue of unreasonable style handling
  • Loading branch information
kampiu authored and MadCcc committed Jan 29, 2024
1 parent 2f75065 commit 7c39b2c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/qr-code/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { unit } from '@ant-design/cssinjs';
import { TinyColor } from '@ctrl/tinycolor';

import { resetComponent } from '../../style';
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
Expand Down Expand Up @@ -63,15 +64,17 @@ const genQRCodeStyle: GenerateStyle<QRCodeToken> = (token) => {
};
};

export const prepareComponentToken: GetDefaultToken<'QRCode'> = () => ({});
export const prepareComponentToken: GetDefaultToken<'QRCode'> = (token) => ({
QRCodeMaskBackgroundColor: new TinyColor(token.colorBgContainer).setAlpha(0.96).toRgbString(),
});

export default genStyleHooks<'QRCode'>(
'QRCode',
(token) => {
const mergedToken = mergeToken<QRCodeToken>(token, {
QRCodeTextColor: 'rgba(0, 0, 0, 0.88)',
QRCodeMaskBackgroundColor: 'rgba(255, 255, 255, 0.96)',
QRCodeTextColor: token.colorText,
});

return genQRCodeStyle(mergedToken);
},
prepareComponentToken,
Expand Down

0 comments on commit 7c39b2c

Please sign in to comment.