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

[Bug] colorStops里color写法 rgb(254 134 22 / 20%)报错 #17274

Open
oseaweed opened this issue Jun 23, 2022 · 6 comments
Open

[Bug] colorStops里color写法 rgb(254 134 22 / 20%)报错 #17274

oseaweed opened this issue Jun 23, 2022 · 6 comments
Assignees

Comments

@oseaweed
Copy link

oseaweed commented Jun 23, 2022

Version

5.3.0

Link to Minimal Reproduction

No response

Steps to Reproduce

color渐变色配置:

areaStyle: {
  opacity: 0.5,
  color: {
    type: 'linear',
    x: 0,
    y: 0,
    x2: 0,
    y2: 1,
    colorStops: [
      {
        offset: 0,
        color: 'rgb(254 134 22 / 20%)',
      },
      {
        offset: 1,
        color: '#fff',
      },
    ],
  },
},

Current Behavior

colorStops里color写法 rgb(254 134 22 / 20%)会报错,改成rgba(254 134 22 / 20%)就好了
image

Expected Behavior

支持 rgb(254 134 22 / 20%)写法

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@oseaweed oseaweed added the bug label Jun 23, 2022
@echarts-bot echarts-bot bot added the missing-title This issue is missing a descriptive title. label Jun 23, 2022
@echarts-bot echarts-bot bot closed this as completed Jun 23, 2022
@echarts-bot
Copy link

echarts-bot bot commented Jun 23, 2022

I'm sorry to close this issue for it lacks the necessary title. Please provide a descriptive and as concise as possible title to describe your problems or requests and then the maintainers or I will reopen this issue.

Every good bug report or feature request starts with a title. Your issue title is a critical element as it's the first thing maintainers see.

A good issue title makes it easier for maintainers to understand what the issue is, easily locate it, and know what steps they'll need to take to fix it.

Moreover, it's better to include keywords, as this makes it easier to find the issue self and similar issues in searches.

@oseaweed oseaweed changed the title [Bug] [Bug] colorStops里color写法 rgb(254 134 22 / 20%报错 Jun 23, 2022
@echarts-bot echarts-bot bot added the pending We are not sure about whether this is a bug/new feature. label Jun 23, 2022
@echarts-bot echarts-bot bot reopened this Jun 23, 2022
@echarts-bot
Copy link

echarts-bot bot commented Jun 23, 2022

@oseaweed It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED

TITLE

[Bug] ColorStops in colorStops is written as rgb (254 134 22/ 20% error reporting

BODY

Version

5.3.0

Link to Minimal Reproduction

No response

Steps to Reproduce

color gradient configuration:
areaStyle: {
opacity: 0.5,
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgb(254 134 22 / 20%)',
},
{
offset: 1,
color: '#fff',
},
],
},
},

Current Behavior

In colorStops, the writing method of color rgb(254 134 22 / 20%) will report an error, just change it to rgba(254 134 22 / 20%)

Expected Behavior

Support rgb (254 134 22 / 20%) writing method

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@echarts-bot echarts-bot bot removed the missing-title This issue is missing a descriptive title. label Jun 23, 2022
@oseaweed oseaweed changed the title [Bug] colorStops里color写法 rgb(254 134 22 / 20%报错 [Bug] colorStops里color写法 rgb(254 134 22 / 20%)报错 Jun 23, 2022
@plainheart
Copy link
Member

建议使用以逗号分隔的传统写法,我记得空格分隔的写法应该还没有得到 echarts 的完整支持。

@plainheart plainheart added enhancement and removed bug pending We are not sure about whether this is a bug/new feature. labels Jun 23, 2022
@oseaweed
Copy link
Author

建议使用以逗号分隔的传统写法,我记得空格分隔的写法应该还没有得到 echarts 的完整支持。

逗号分割也不行 得用rgba的写法 目前只有用这里会报错

@plainheart
Copy link
Member

带透明度一般还是建议用 rgba 而不是 rgb,尽量使用传统写法,一些浏览器支持的新写法还没有全面兼容。

@fuchunhui fuchunhui self-assigned this Jun 29, 2022
@fuchunhui
Copy link
Contributor

ecomfe/zrender#932

加了正则检测,转换处理。

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

No branches or pull requests

3 participants