improved color generation for date
resolving timing issue, minor fixes and refactoring
improving code and performance