简体   繁体   English

如何在paper.js中使用toCSS()?

[英]How do I use toCSS() in paper.js?

Paper.js says it has a function toCSS(hex) which returns the color as a CSS string, either in hex or not. Paper.js表示它具有toCSS(hex)函数,该函数以十六进制或非十六进制形式将颜色作为CSS字符串返回。

http://paperjs.org/reference/color/#tocss-hex http://paperjs.org/reference/color/#tocss-hex

Does anyone know how to use this I have had no luck and can find no examples. 有谁知道如何使用这个我没有运气,也找不到任何例子。

I am trying to convert a var Color which =hit.item.fillcolor which appears to be a ctor. 我正在尝试转换= hit.item.fillcolor的var Color,它看起来像是ctor。 If I try to use toCSS I get Color.toCSS is not a function. 如果我尝试使用toCSS,我会得到Color.toCSS不是一个函数。

The function above toCSS in the documentation - toString() works fine. 文档中toCSS上方toCSS()的函数运行正常。

Any clues? 有什么线索吗?

I'm not exactly sure what you're asking but here is an issue. 我不确定您要问的是什么,但这是一个问题。

The fill color is item.fillColor , not item.fillcolor , which is undefined. 填充颜​​色是item.fillColor ,不是item.fillcolor ,它是未定义的。

That's why you get Color.toCSS() is not a function. 这就是为什么您获得Color.toCSS()不是函数的原因。


  • toCSS(false) returns this format: "rgb(0,230,191)" toCSS(false)返回此格式:“ rgb(0,230,191)”
  • toCSS(true) returns this format: "#00e6bf" toCSS(true)返回以下格式:“#00e6bf”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM