avp / spectra

A Javascript color library. Quickly manipulate and convert colors.
avp.github.io/spectra
MIT License
237 stars 18 forks source link

Replaced abuse of the logical or operator #26

Closed Azeirah closed 8 years ago

Azeirah commented 8 years ago

Statements like

function someFunc(x) {
    x = x || 1;
    return x;
}

Can fail unexpectedly, as for example 0 is falsy, someFunc(0) returns 1.

I was playing around with spectra, diminishing alpha values over time.. When alpha reached 0, alpha was suddenly 1, fully opaque!

var c = Spectra({r: 0, g: 0, b: 0, a: 0}).rgbaString()

Should be rgba(0, 0, 0, 0), but is rgba(0, 0, 0, 1) instead!

This has been fixed in this pull request.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 99.259% when pulling bf449ca67905219d4357ffc4bd922f0cb88fc78d on Azeirah:master into 13fa41d08dd703eb38ccbb82ca332f745907abad on avp:master.

Azeirah commented 8 years ago

Thanks for taking the time to merging this request, not all package maintainers take the time to manage their projects after development has stalled.