Color text based on background color when using `_background_gradient()`
The purpose of this PR is to automatically color text dark or light based on the background color of the HTML table:

================`old behavior` ===========================`new behavior`========
![image](https://user-images.githubusercontent.com/4560057/40745876-b43b17ca-6426-11e8-892c-7f27598789de.png) ![image](https://user-images.githubusercontent.com/4560057/40744927-0e2796a8-6424-11e8-9837-53566d53bef6.png)

As described in #21258, I use the luminance-based approach from `seaborn`'s annotated heatmaps. Tagging @WillAyd who commented on that issue. A few comments on this PR

1. Initially, I was not sure if defining the `relative_luminance()` method within `_background_gradient()` was the right way to go, but I opted for this since I saw the same approach elsewhere in the file. Let me know if you prefer a different approach.

2. I am not sure how intuitive it is that a parameter named `text_color` takes a numeric argument and not a color, but I think it is a good name for discoverability. Naming it `luminance_threshold` or similar might be confusing for users looking for a way to change the text color.

3. I opted to make the light text not completely white. The focus should be the background color so the text should not pop out too much. Thoughts?


================`#ffffff` ============================`#f1f1f1` (current choice)===
![image](https://user-images.githubusercontent.com/4560057/40744958-25ba1ac0-6424-11e8-9b51-afaf0a1d05c8.png) ![image](https://user-images.githubusercontent.com/4560057/40744927-0e2796a8-6424-11e8-9837-53566d53bef6.png)

![image](https://user-images.githubusercontent.com/4560057/40745533-b2b81c46-6425-11e8-8bdd-e743441a5b18.png) ![image](https://user-images.githubusercontent.com/4560057/40745507-a54dd0e6-6425-11e8-8e92-50afbd986c57.png)


4. I think 0.2 is a good default threshold value for `text_color` based on my own qualitative assessment, feel free to disagree. The seaborn default of 0.4 makes too much text white in my opinion. Since colors and contrast can be quite subjective, I thought I would include some comparisons.

============`text_color=0.4` ======================`text_color=0.2` (current choice)===
![image](https://user-images.githubusercontent.com/4560057/40745779-6620b1ee-6426-11e8-830a-6517239c8305.png) ![image](https://user-images.githubusercontent.com/4560057/40745632-f692805a-6425-11e8-8f1f-9ff00b81965f.png)
![image](https://user-images.githubusercontent.com/4560057/40745801-7332014e-6426-11e8-88b5-75b34ecfd6ca.png) ![image](https://user-images.githubusercontent.com/4560057/40745647-0653f08c-6426-11e8-995f-b69e6dd1c85c.png)
![image](https://user-images.githubusercontent.com/4560057/40745756-4fd3ef5a-6426-11e8-9335-855a09c2ec56.png) ![image](https://user-images.githubusercontent.com/4560057/40745721-3d98f48e-6426-11e8-9511-a3a9d4b52225.png)


This is my first PR, apologies if I have misunderstood something. 

- [x] closes #21258 
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21263?src=pr&el=h1) Report
> Merging [#21263](https://codecov.io/gh/pandas-dev/pandas/pull/21263?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c85ab083919b59ce84c220d5baf7d34ff4a0bcf2?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/21263/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/21263?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #21263      +/-   ##
==========================================
+ Coverage   91.84%   91.85%   +<.01%     
==========================================
  Files         153      153              
  Lines       49538    49555      +17     
==========================================
+ Hits        45499    45518      +19     
+ Misses       4039     4037       -2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.25% <100%> (ø)` | :arrow_up: |
| #single | `41.86% <9.09%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21263?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/style.py](https://codecov.io/gh/pandas-dev/pandas/pull/21263/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvc3R5bGUucHk=) | `96.12% <100%> (+0.08%)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/21263/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.22% <0%> (ø)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/21263/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.12% <0%> (ø)` | :arrow_up: |
| [pandas/util/\_decorators.py](https://codecov.io/gh/pandas-dev/pandas/pull/21263/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvX2RlY29yYXRvcnMucHk=) | `82.25% <0%> (ø)` | :arrow_up: |
| [pandas/tseries/offsets.py](https://codecov.io/gh/pandas-dev/pandas/pull/21263/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvb2Zmc2V0cy5weQ==) | `97% <0%> (ø)` | :arrow_up: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/21263/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `95.69% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/sparse/array.py](https://codecov.io/gh/pandas-dev/pandas/pull/21263/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2FycmF5LnB5) | `91.38% <0%> (+0.06%)` | :arrow_up: |
| [pandas/core/algorithms.py](https://codecov.io/gh/pandas-dev/pandas/pull/21263/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYWxnb3JpdGhtcy5weQ==) | `94.81% <0%> (+0.31%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21263?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21263?src=pr&el=footer). Last update [c85ab08...41911af](https://codecov.io/gh/pandas-dev/pandas/pull/21263?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 Thanks for the changes. Assuming tests pass I'll approve on my end @WillAyd Thank you for all the help, much appreciated! @TomAugspurger : Could you take a look? Thanks @joelostblom! thanks for this improvement.

FYI: under PR #21259  I add support for `axis=None` in `background_gradient`. As a side effect I could simplify the implementation of the `relative_luminance` function that was added here, because it now just receives a rgba tuple/array directly (instead of a color hex string that had to be parsed).