sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.16k stars 211 forks source link

other users: onecolor(bg).magenta is not a function #1713

Open haraldschilly opened 7 years ago

haraldschilly commented 7 years ago

stacktrace:

TypeError: v(...).magenta is not a function
    at Object.render_letter (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:64:13681)
    at Object.render_inside (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:64:13438)
    at Object.render (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:64:14325)
    at u._renderValidatedComponentWithoutOwnerOrContext (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:189:11121)
    at u._renderValidatedComponent (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:189:11248)
    at u.performInitialMount (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:189:7074)
    at u.mountComponent (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:189:6120)
    at Object.mountComponent (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:31:25991)
    at u.performInitialMount (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:189:7234)
    at u.mountComponent (https://cloud.sagemath.com/static/smc-781516e0eeb3b872c86b.js?781516e0eeb3b872c86b:189:6120)

i.e.

{backgroundColor:e,color:v(e).magenta()>=.4?"white":"black"}

which is due to the fact, that one would need to have one-color-all.js for the magenta function -- explained here: https://github.com/One-com/one-color

My naive thought is, do we really need that lib as a dependency? and besides that, why not just use lightness() instead of magenta() ?

williamstein commented 7 years ago

My naive thought is, do we really need that lib as a dependency? and besides that, why not just use lightness() instead of magenta()

You can try that instead if you want -- make sure to run through the full range of colors to make sure that things always stay visible -- it's harder than you might think and requires testing!

DrXyzzy commented 7 years ago

@williamstein - ok to close this?

haraldschilly commented 7 years ago

@DrXyzzy no, keep it open, I don't even know what exactly to test here, but it seems to be something I should have a look at

williamstein commented 7 years ago

I'm changing this to not a bug, since I did fix the bug.