```
for (int i=0; i<barCount; ++i) {
   bar.backgroundColor = i < priority ? green : grey;
}
```