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

relj7zay  于 2022-12-31  发布在  Echarts
关注(0)|答案(6)|浏览(288)

Version

5.3.0

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%)就好了

Expected Behavior

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

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

sg3maiej

sg3maiej1#

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.

xsuvu9jc

xsuvu9jc2#

@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

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

dced5bon

dced5bon3#

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

wvt8vs2t

wvt8vs2t4#

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

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

shstlldc

shstlldc5#

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

u1ehiz5o

u1ehiz5o6#

ecomfe/zrender#932

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

相关问题