color assignment moved to seperate function