R/gt_hulk_color.R
gt_hulk_color.Rd
Apply 'hulk' palette to specific columns in a gt table. The hulk names comes from the idea of a divergin purple and green theme that is colorblind safe and visually appealing. It is a useful alternative to the red/green palette.
gt_hulk_color(gt_object, ..., domain = NULL, trim = FALSE, reverse = FALSE)
An existing gt table object
columns to apply color to
trim the palette to give less intense maximal colors
reverse the color palette. The default is green = high and purple = low, but reverse = TRUE will make purple high and green low.
Returns a gt table
# basic use
mtcars |>
head() |>
gt::gt() |>
gt_hulk_color(mpg)
#> <div id="jxqndvvuye" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>html {
#> font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
#> }
#>
#> #jxqndvvuye .gt_table {
#> display: table;
#> border-collapse: collapse;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #jxqndvvuye .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 0;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #jxqndvvuye .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #jxqndvvuye .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #jxqndvvuye .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #jxqndvvuye .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #jxqndvvuye .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #jxqndvvuye .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #jxqndvvuye .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #jxqndvvuye .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #jxqndvvuye .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #jxqndvvuye .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #jxqndvvuye .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #jxqndvvuye .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #jxqndvvuye .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #jxqndvvuye .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #jxqndvvuye .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #jxqndvvuye .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #jxqndvvuye .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #jxqndvvuye .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-left: 4px;
#> padding-right: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #jxqndvvuye .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #jxqndvvuye .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #jxqndvvuye .gt_left {
#> text-align: left;
#> }
#>
#> #jxqndvvuye .gt_center {
#> text-align: center;
#> }
#>
#> #jxqndvvuye .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #jxqndvvuye .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #jxqndvvuye .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #jxqndvvuye .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #jxqndvvuye .gt_super {
#> font-size: 65%;
#> }
#>
#> #jxqndvvuye .gt_footnote_marks {
#> font-style: italic;
#> font-weight: normal;
#> font-size: 75%;
#> vertical-align: 0.4em;
#> }
#>
#> #jxqndvvuye .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #jxqndvvuye .gt_indent_1 {
#> text-indent: 5px;
#> }
#>
#> #jxqndvvuye .gt_indent_2 {
#> text-indent: 10px;
#> }
#>
#> #jxqndvvuye .gt_indent_3 {
#> text-indent: 15px;
#> }
#>
#> #jxqndvvuye .gt_indent_4 {
#> text-indent: 20px;
#> }
#>
#> #jxqndvvuye .gt_indent_5 {
#> text-indent: 25px;
#> }
#> </style>
#> <table class="gt_table">
#>
#> <thead class="gt_col_headings">
#> <tr>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">mpg</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">cyl</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">disp</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">hp</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">drat</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">wt</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">qsec</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">vs</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">am</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">gear</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">carb</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr><td class="gt_row gt_right" style="background-color: #ECDEEC; color: #000000;">21.0</td>
#> <td class="gt_row gt_right">6</td>
#> <td class="gt_row gt_right">160</td>
#> <td class="gt_row gt_right">110</td>
#> <td class="gt_row gt_right">3.90</td>
#> <td class="gt_row gt_right">2.620</td>
#> <td class="gt_row gt_right">16.46</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">4</td>
#> <td class="gt_row gt_right">4</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #ECDEEC; color: #000000;">21.0</td>
#> <td class="gt_row gt_right">6</td>
#> <td class="gt_row gt_right">160</td>
#> <td class="gt_row gt_right">110</td>
#> <td class="gt_row gt_right">3.90</td>
#> <td class="gt_row gt_right">2.875</td>
#> <td class="gt_row gt_right">17.02</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">4</td>
#> <td class="gt_row gt_right">4</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #762A83; color: #FFFFFF;">22.8</td>
#> <td class="gt_row gt_right">4</td>
#> <td class="gt_row gt_right">108</td>
#> <td class="gt_row gt_right">93</td>
#> <td class="gt_row gt_right">3.85</td>
#> <td class="gt_row gt_right">2.320</td>
#> <td class="gt_row gt_right">18.61</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">4</td>
#> <td class="gt_row gt_right">1</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #DBC5E0; color: #000000;">21.4</td>
#> <td class="gt_row gt_right">6</td>
#> <td class="gt_row gt_right">258</td>
#> <td class="gt_row gt_right">110</td>
#> <td class="gt_row gt_right">3.08</td>
#> <td class="gt_row gt_right">3.215</td>
#> <td class="gt_row gt_right">19.44</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">3</td>
#> <td class="gt_row gt_right">1</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #6AAE6A; color: #000000;">18.7</td>
#> <td class="gt_row gt_right">8</td>
#> <td class="gt_row gt_right">360</td>
#> <td class="gt_row gt_right">175</td>
#> <td class="gt_row gt_right">3.15</td>
#> <td class="gt_row gt_right">3.440</td>
#> <td class="gt_row gt_right">17.02</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">3</td>
#> <td class="gt_row gt_right">2</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #1B7837; color: #FFFFFF;">18.1</td>
#> <td class="gt_row gt_right">6</td>
#> <td class="gt_row gt_right">225</td>
#> <td class="gt_row gt_right">105</td>
#> <td class="gt_row gt_right">2.76</td>
#> <td class="gt_row gt_right">3.460</td>
#> <td class="gt_row gt_right">20.22</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">3</td>
#> <td class="gt_row gt_right">1</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>
mtcars |>
head() |>
gt::gt() |>
# trim gives small range of colors
gt_hulk_color(mpg:disp, trim = TRUE)
#> <div id="uqbdzqslhz" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>html {
#> font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
#> }
#>
#> #uqbdzqslhz .gt_table {
#> display: table;
#> border-collapse: collapse;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #uqbdzqslhz .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 0;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #uqbdzqslhz .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #uqbdzqslhz .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #uqbdzqslhz .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #uqbdzqslhz .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #uqbdzqslhz .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #uqbdzqslhz .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #uqbdzqslhz .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #uqbdzqslhz .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #uqbdzqslhz .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #uqbdzqslhz .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #uqbdzqslhz .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #uqbdzqslhz .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #uqbdzqslhz .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #uqbdzqslhz .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #uqbdzqslhz .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #uqbdzqslhz .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #uqbdzqslhz .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #uqbdzqslhz .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-left: 4px;
#> padding-right: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #uqbdzqslhz .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #uqbdzqslhz .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #uqbdzqslhz .gt_left {
#> text-align: left;
#> }
#>
#> #uqbdzqslhz .gt_center {
#> text-align: center;
#> }
#>
#> #uqbdzqslhz .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #uqbdzqslhz .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #uqbdzqslhz .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #uqbdzqslhz .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #uqbdzqslhz .gt_super {
#> font-size: 65%;
#> }
#>
#> #uqbdzqslhz .gt_footnote_marks {
#> font-style: italic;
#> font-weight: normal;
#> font-size: 75%;
#> vertical-align: 0.4em;
#> }
#>
#> #uqbdzqslhz .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #uqbdzqslhz .gt_indent_1 {
#> text-indent: 5px;
#> }
#>
#> #uqbdzqslhz .gt_indent_2 {
#> text-indent: 10px;
#> }
#>
#> #uqbdzqslhz .gt_indent_3 {
#> text-indent: 15px;
#> }
#>
#> #uqbdzqslhz .gt_indent_4 {
#> text-indent: 20px;
#> }
#>
#> #uqbdzqslhz .gt_indent_5 {
#> text-indent: 25px;
#> }
#> </style>
#> <table class="gt_table">
#>
#> <thead class="gt_col_headings">
#> <tr>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">mpg</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">cyl</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">disp</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">hp</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">drat</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">wt</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">qsec</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">vs</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">am</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">gear</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col">carb</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr><td class="gt_row gt_right" style="background-color: #F0E7F0; color: #000000;">21.0</td>
#> <td class="gt_row gt_right" style="background-color: #F7F7F7; color: #000000;">6</td>
#> <td class="gt_row gt_right" style="background-color: #C9E7C3; color: #000000;">160</td>
#> <td class="gt_row gt_right">110</td>
#> <td class="gt_row gt_right">3.90</td>
#> <td class="gt_row gt_right">2.620</td>
#> <td class="gt_row gt_right">16.46</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">4</td>
#> <td class="gt_row gt_right">4</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #F0E7F0; color: #000000;">21.0</td>
#> <td class="gt_row gt_right" style="background-color: #F7F7F7; color: #000000;">6</td>
#> <td class="gt_row gt_right" style="background-color: #C9E7C3; color: #000000;">160</td>
#> <td class="gt_row gt_right">110</td>
#> <td class="gt_row gt_right">3.90</td>
#> <td class="gt_row gt_right">2.875</td>
#> <td class="gt_row gt_right">17.02</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">4</td>
#> <td class="gt_row gt_right">4</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #AF8DC3; color: #000000;">22.8</td>
#> <td class="gt_row gt_right" style="background-color: #7FBF7B; color: #000000;">4</td>
#> <td class="gt_row gt_right" style="background-color: #7FBF7B; color: #000000;">108</td>
#> <td class="gt_row gt_right">93</td>
#> <td class="gt_row gt_right">3.85</td>
#> <td class="gt_row gt_right">2.320</td>
#> <td class="gt_row gt_right">18.61</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">4</td>
#> <td class="gt_row gt_right">1</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #EADBEB; color: #000000;">21.4</td>
#> <td class="gt_row gt_right" style="background-color: #F7F7F7; color: #000000;">6</td>
#> <td class="gt_row gt_right" style="background-color: #F1EAF1; color: #000000;">258</td>
#> <td class="gt_row gt_right">110</td>
#> <td class="gt_row gt_right">3.08</td>
#> <td class="gt_row gt_right">3.215</td>
#> <td class="gt_row gt_right">19.44</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">3</td>
#> <td class="gt_row gt_right">1</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #ADD8A7; color: #000000;">18.7</td>
#> <td class="gt_row gt_right" style="background-color: #AF8DC3; color: #000000;">8</td>
#> <td class="gt_row gt_right" style="background-color: #AF8DC3; color: #000000;">360</td>
#> <td class="gt_row gt_right">175</td>
#> <td class="gt_row gt_right">3.15</td>
#> <td class="gt_row gt_right">3.440</td>
#> <td class="gt_row gt_right">17.02</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">3</td>
#> <td class="gt_row gt_right">2</td></tr>
#> <tr><td class="gt_row gt_right" style="background-color: #7FBF7B; color: #000000;">18.1</td>
#> <td class="gt_row gt_right" style="background-color: #F7F7F7; color: #000000;">6</td>
#> <td class="gt_row gt_right" style="background-color: #F3F6F2; color: #000000;">225</td>
#> <td class="gt_row gt_right">105</td>
#> <td class="gt_row gt_right">2.76</td>
#> <td class="gt_row gt_right">3.460</td>
#> <td class="gt_row gt_right">20.22</td>
#> <td class="gt_row gt_right">1</td>
#> <td class="gt_row gt_right">0</td>
#> <td class="gt_row gt_right">3</td>
#> <td class="gt_row gt_right">1</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>
# option to reverse the color palette
mtcars |>
head() |>
gt::gt() |>
# trim gives small range of colors
gt_hulk_color(mpg:disp, rev = TRUE)
#> Error in gt::data_color(gt_object, columns = ..., colors = hulk_pal): unused argument (rev = TRUE)