ENH: Styler.text_gradient: easy extension alternative to .background_gradient by attack68 · Pull Request #41098 · pandas-dev/pandas (original) (raw)

This is minor code alteration to the _background_gradient function that permits a text-only coloring version, i.e. Styler.text_gradient.

This could alternatively be performed with a text_only=True keyword addition to Styler.background_gradient existing method, but it seemed dissimilar enough to merit its own method (and avoid adding more kwargs).

Screen Shot 2021-04-22 at 14 24 45
Screen Shot 2021-04-22 at 14 24 57