Refactor get background colors method.