You can calculate a color number out of the expected possible value range of the expression you have.
For instance if an expression yields typically values between 5000 and 10000 you can adapt this to colors between 1 and 5. That would be simply to divide by 1000 and subtract 4. This would be a static way of doing it that might work well for a lot of cases. You could to it dynamically by finding the max value of the expression over the range of dimension values you will use either out of context of the chart which would be semi-dynamic or directly in the context of the chart completely dynamic. The complexity to achieve this increase with the level of dynamism...
So for the simple static case I mentioned above you would have:
Color( Sum(....... ) / 1000 - 4 )
as a color expression.
Please go through the below link, it may be helpful.
The approach aims to use an expression that doesn't need to be rewritten each time the measure changes and can be copied across different objects without changes.