You can't (easily) set the overall background colour of a text widget as that is part of the overall theme of the dashboard. Also what part would the background mean anyway... as the payload element is just the small area around the text - likewise the label element. The widget background could possibly be targeted by custom CSS via a template - but then, as already noted, you may as well use the template for the whole widget.
@Andrei 's answer above is the simplest approach for a dynamic colour change in the text widget.