I like to display some decimal numbers. As many as possible need to have a unique brush in WPF.
example
-1.00 (display in Green and Orange)
0.00 (display in Orange)
1.00 (display in Green)
2.00 (display in Red)
no specified pattern is needed.
RBG is to small for my case.
255 * 255 * 255 = 16 581 375
The color for a value have to be always the same.
public Brush GetValueColor(decimal value)
{
//Generate Brush for value
return myBrush;
}
I don’t know what is wrong with my question but whatever. Just need a function to return a unique brush for every unique number. It doesn’t mater how the numbers looks like.
You could always generate a
LinearGradientBrushwithGradientStopsbased on the bytes from value.ToString(). You can also reverse theLinearGradientBrushback to the decimal value if needed.GetValueColor
Reverse: GetColorValue