css3 - CSS Saturate Filter on Canvas -


i have canvas drawing grey scale diagram (jsbin example).

it's radial progress meter, used lot in application. however, rather colouring javascript, i'd prefer able give colour based on class.

i thought ideal use case css filters. i'd draw default progress meter in gray, use css filters add saturation , hue rotation, in order achieve blue, orange , green too.

canvas {   -webkit-filter: saturate(8); } 

the rule supported , valid in chrome, problem was, doesn't seem change saturation @ all.

i'm imagining #aaa transformed it's hsl counterpart hsl(0, 0%, 67%). when increase saturation filter, should become more saturated, same hue.

i hoping end hsl(0, 50%, 67%) instead, filter doesn't seem change colour @ all, no matter value use.

any ideas?

it turns out if draw meter saturation initially, can use hue-rotate filter , can desaturate them achieve grey scale again.

http://jsbin.com/qohokivobo/2/edit?html,css,output

conceptually, isn't answer. in meantime, it's solution.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -