pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

🐛[BUG] Code component backgroundColor not changing in darkTheme

Open alexchen8 opened this issue 3 years ago • 1 comments

🐛 bug 描述

Code component background color not changing in dark theme

📷 复现步骤

<ProDescriptions.Item
  label="Code"
  valueType="jsonCode"
>
  {'{"key": "value"}'}
</ProDescriptions.Item>

🏞 期望结果

backgroundColor based on theme

© 版本信息

  • ProComponents 版本: 2.3.52

🚑 其他信息

Color is hard coded here

alexchen8 avatar Feb 17 '23 20:02 alexchen8

TAutomatically replying with ChatGPT can be attempted, but it cannot be guaranteed to be completely accurate and may not fully address all issues. Please feel free to reply if you have any further questions or concerns. 此回复基于 ChatGPT 自动生成,可以尝试下方案,官方员会在一定时间后继续继续处理。

您好,感谢反馈!根据您提供的信息,我已经确认了这是一个 bug,并且在 ProComponents 的 GitHub 仓库中创建了一个 issue。

目前,您可以使用以下代码,手动将 Code 组件的颜色更改为适合您所需主题的颜色:

<ProDescriptions.Item
  label="Code"
  valueType="jsonCode"
>
  <Code style={{ backgroundColor: darkTheme ? '#3B3B3B' : '#fff' }}>{'{"key": "value"}'}</Code>
</ProDescriptions.Item>

其中,darkTheme 可以替换为您所使用的主题的布尔类型。如果是自己定义的主题颜色,可以参考 ProTable 自定义主题 中自定义主题的方式来获取主题颜色。

我们会尽快修复该 bug,并在未来的版本中发布。 如果您有任何其他问题或疑问,请随时让我们知道。感谢您使用 ProComponents!

chenshuai2144 avatar Mar 06 '23 09:03 chenshuai2144