typestyle / csx

Utility functions for TypeStyle
https://typestyle.github.io
MIT License
102 stars 14 forks source link

css('colorName') always return 'rgb(255, 0, 0)' #46

Closed zheeeng closed 6 years ago

zheeeng commented 6 years ago

version: 9.0.0

  console.log(csx.color('red').toString())
  console.log(csx.color('green').toString())
  console.log(csx.color('blue').toString())

output:

rgb(255,0,0)
rgb(255,0,0)
rgb(255,0,0)
notoriousb1t commented 6 years ago

We removed named colors in 9.0.0 because they increased the bundle size of the library substantially and because it appeared that no one was using them. (there are well over 100 named colors) There was discussion about making them an optional import, but I was concerned about over-complicating a helper library.

The reason it shows up as red is because that is the default color we assign when the color cannot be parsed.

notoriousb1t commented 6 years ago

I apologize that the docs don't reflect this. I am marking this as docs so we can go back and remedy that.

zheeeng commented 6 years ago

Thx for your reply.