scripts/rainbows: minor refactoring