{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using Font ColorMaps" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Similarly to coloring each ColumnCells background based on its value, you can color each cells text.\n", "\n", "You can do this by providing a `text_cmap` to a `ColumnDefinition`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Auto-Coloring of text\n", "\n", "You can auto-color text based on the cells backgrounds (or bbox-patches) colors.\n", "\n", "You do this after instantiating the table." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```python\n", "autoset_fontcolors(\n", " self, fn: Callable = None, colnames: List[str] = None, **kwargs\n", " ) -> Table:\n", " \"\"\"Sets the fontcolor of each table cells text based on the facecolor of its rectangle patch.\n", "\n", " Args:\n", " fn (Callable, optional):\n", " Callable that takes the rectangle patches facecolor as\n", " rgba-value as argument.\n", " Defaults to plottable.font.contrasting_font_color if fn is None.\n", " kwargs are passed to fn.\n", "\n", " Returns:\n", " plottable.table.Table\n", " \"\"\"\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```{seealso}\n", "You can find an example of autosetting fontcolors for specific columns in the [Women's World Cup Example](../example_notebooks/wwc_example.ipynb)\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.10.5 ('env': venv)", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.10.5" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "fad163352f6b6c4f05b9b8d41b1f28c58b235e61ec56c8581176f01128143b49" } } }, "nbformat": 4, "nbformat_minor": 2 }