Fix RGB conversion code, add brightness control.