Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(QRCode): Fix the issue where the background color and font color … #47128

Merged
merged 5 commits into from
Jan 26, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 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,16 @@ const genQRCodeStyle: GenerateStyle<QRCodeToken> = (token) => {
};
};

export const prepareComponentToken: GetDefaultToken<'QRCode'> = () => ({});
export const prepareComponentToken: GetDefaultToken<'QRCode'> = (token) => ({
QRCodeTextColor: new TinyColor(token.colorText).toRgbString(),
afc163 marked this conversation as resolved.
Show resolved Hide resolved
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)',
});
const mergedToken = mergeToken<QRCodeToken>(token);

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