No, you should not put all your constants at the top of your main class or in your class, they should go in any class with which they are logically connected.
The problem is that if the programmer sees a common place for placing something, for example, a file of constants, then they will put all the constants here to maintain the template, whereas they should put them in the right and logical place. The presence of one large file of constants makes it difficult to work with constants, since they are not effectively classified and break modularity. Your role as an architect is to avoid creating a system with such traps.
So, say, for example, you have system properties related to managing your Java application, which means there are some of these constants in your main class. If you end up too much in your main class, move them to the SystemProperties class in the same package. When a programmer needs several constants for their own use, say, for colors in your example, they must create their own class Colors, which is included in the package associated with this function that contains these constants.
source share