Skip to content

Conversation

NullIsObject
Copy link

Types of changes

  • New feature
  • Bug fix
  • Enhancement
  • Component style change
  • Typescript definition change
  • Documentation change
  • Coding style change
  • Refactoring
  • Test cases
  • Continuous integration
  • Breaking change
  • Others

Background and context

color-picker 提供了history-colors 和 preset-colors两个props。当传入的值为rgb或者带不透明度的16进制值时,如果用户选择这部分颜色,组件的rgb值为红色,而不透明度不会变化

Solution

在packages/web-vue/components/color-picker/panel.tsx中,修改了onHexInputChange方法的格式化颜色的代码,保证颜色的正常格式化,同时,额外调用onAlphaChange触发不透明度的更新

How is the change tested?

为history-colors 或者 preset-colors传入带有不透明度的16进制颜色值,或者rgb值,并在界面上选择这部分颜色即可复现。官网有提供"预设颜色和历史颜色"的示例,可以选择一个带不透明度的颜色值以将其添加到历史,再从历史中选中

Changelog

Component Changelog(CN) Changelog(EN) Related issues
color-picker 修复color-picker的 "预设颜色和最近使用颜色" 功能 对部分值无法正确格式化的问题 Resolve the formatting issue in the color-picker's 'preset and recent colors' functionality for certain values.

Checklist:

  • Test suite passes (npm run test)
  • Provide changelog for relevant changes (e.g. bug fixes and new features) if applicable.
  • Changes are submitted to the appropriate branch (e.g. features should be submitted to feature branch and others
    should be submitted to main branch)

Other information

Copy link

codesandbox bot commented Aug 18, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant