Color Sensing with TCS3200, Need Help with Code & Understanding

Just take care that you change each negative value to 0 before outputting it. A negative value just becomes another positive value. val + 256 or something similar. Better set it to zero.