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)

Arguments

gt_object

An existing gt table object

...

columns to apply color to

trim

trim the palette to give less intense maximal colors

reverse

reverse the color palette. The default is green = high and purple = low, but reverse = TRUE will make purple high and green low.

Value

Returns a gt table

Examples

# basic use mtcars |> head() |> gt::gt() |> gt_hulk_color(mpg)
#> <div id="mwlefoodfi" 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; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .gt_title { #> color: #333333; #> font-size: 125%; #> font-weight: initial; #> padding-top: 4px; #> padding-bottom: 4px; #> border-bottom-color: #FFFFFF; #> border-bottom-width: 0; #> } #> #> #mwlefoodfi .gt_subtitle { #> color: #333333; #> font-size: 85%; #> font-weight: initial; #> padding-top: 0; #> padding-bottom: 6px; #> border-top-color: #FFFFFF; #> border-top-width: 0; #> } #> #> #mwlefoodfi .gt_bottom_border { #> border-bottom-style: solid; #> border-bottom-width: 2px; #> border-bottom-color: #D3D3D3; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .gt_column_spanner_outer:first-child { #> padding-left: 0; #> } #> #> #mwlefoodfi .gt_column_spanner_outer:last-child { #> padding-right: 0; #> } #> #> #mwlefoodfi .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%; #> } #> #> #mwlefoodfi .gt_group_heading { #> padding: 8px; #> 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; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .gt_from_md > :first-child { #> margin-top: 0; #> } #> #> #mwlefoodfi .gt_from_md > :last-child { #> margin-bottom: 0; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .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: 12px; #> } #> #> #mwlefoodfi .gt_summary_row { #> color: #333333; #> background-color: #FFFFFF; #> text-transform: inherit; #> padding-top: 8px; #> padding-bottom: 8px; #> padding-left: 5px; #> padding-right: 5px; #> } #> #> #mwlefoodfi .gt_first_summary_row { #> padding-top: 8px; #> padding-bottom: 8px; #> padding-left: 5px; #> padding-right: 5px; #> border-top-style: solid; #> border-top-width: 2px; #> border-top-color: #D3D3D3; #> } #> #> #mwlefoodfi .gt_grand_summary_row { #> color: #333333; #> background-color: #FFFFFF; #> text-transform: inherit; #> padding-top: 8px; #> padding-bottom: 8px; #> padding-left: 5px; #> padding-right: 5px; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .gt_striped { #> background-color: rgba(128, 128, 128, 0.05); #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .gt_footnote { #> margin: 0px; #> font-size: 90%; #> padding: 4px; #> } #> #> #mwlefoodfi .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; #> } #> #> #mwlefoodfi .gt_sourcenote { #> font-size: 90%; #> padding: 4px; #> } #> #> #mwlefoodfi .gt_left { #> text-align: left; #> } #> #> #mwlefoodfi .gt_center { #> text-align: center; #> } #> #> #mwlefoodfi .gt_right { #> text-align: right; #> font-variant-numeric: tabular-nums; #> } #> #> #mwlefoodfi .gt_font_normal { #> font-weight: normal; #> } #> #> #mwlefoodfi .gt_font_bold { #> font-weight: bold; #> } #> #> #mwlefoodfi .gt_font_italic { #> font-style: italic; #> } #> #> #mwlefoodfi .gt_super { #> font-size: 65%; #> } #> #> #mwlefoodfi .gt_footnote_marks { #> font-style: italic; #> font-weight: normal; #> font-size: 65%; #> } #> </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">mpg</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">cyl</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">disp</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">hp</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">drat</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">wt</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">qsec</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">vs</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">am</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">gear</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">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="eexombwkke" 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; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .gt_title { #> color: #333333; #> font-size: 125%; #> font-weight: initial; #> padding-top: 4px; #> padding-bottom: 4px; #> border-bottom-color: #FFFFFF; #> border-bottom-width: 0; #> } #> #> #eexombwkke .gt_subtitle { #> color: #333333; #> font-size: 85%; #> font-weight: initial; #> padding-top: 0; #> padding-bottom: 6px; #> border-top-color: #FFFFFF; #> border-top-width: 0; #> } #> #> #eexombwkke .gt_bottom_border { #> border-bottom-style: solid; #> border-bottom-width: 2px; #> border-bottom-color: #D3D3D3; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .gt_column_spanner_outer:first-child { #> padding-left: 0; #> } #> #> #eexombwkke .gt_column_spanner_outer:last-child { #> padding-right: 0; #> } #> #> #eexombwkke .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%; #> } #> #> #eexombwkke .gt_group_heading { #> padding: 8px; #> 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; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .gt_from_md > :first-child { #> margin-top: 0; #> } #> #> #eexombwkke .gt_from_md > :last-child { #> margin-bottom: 0; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .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: 12px; #> } #> #> #eexombwkke .gt_summary_row { #> color: #333333; #> background-color: #FFFFFF; #> text-transform: inherit; #> padding-top: 8px; #> padding-bottom: 8px; #> padding-left: 5px; #> padding-right: 5px; #> } #> #> #eexombwkke .gt_first_summary_row { #> padding-top: 8px; #> padding-bottom: 8px; #> padding-left: 5px; #> padding-right: 5px; #> border-top-style: solid; #> border-top-width: 2px; #> border-top-color: #D3D3D3; #> } #> #> #eexombwkke .gt_grand_summary_row { #> color: #333333; #> background-color: #FFFFFF; #> text-transform: inherit; #> padding-top: 8px; #> padding-bottom: 8px; #> padding-left: 5px; #> padding-right: 5px; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .gt_striped { #> background-color: rgba(128, 128, 128, 0.05); #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .gt_footnote { #> margin: 0px; #> font-size: 90%; #> padding: 4px; #> } #> #> #eexombwkke .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; #> } #> #> #eexombwkke .gt_sourcenote { #> font-size: 90%; #> padding: 4px; #> } #> #> #eexombwkke .gt_left { #> text-align: left; #> } #> #> #eexombwkke .gt_center { #> text-align: center; #> } #> #> #eexombwkke .gt_right { #> text-align: right; #> font-variant-numeric: tabular-nums; #> } #> #> #eexombwkke .gt_font_normal { #> font-weight: normal; #> } #> #> #eexombwkke .gt_font_bold { #> font-weight: bold; #> } #> #> #eexombwkke .gt_font_italic { #> font-style: italic; #> } #> #> #eexombwkke .gt_super { #> font-size: 65%; #> } #> #> #eexombwkke .gt_footnote_marks { #> font-style: italic; #> font-weight: normal; #> font-size: 65%; #> } #> </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">mpg</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">cyl</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">disp</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">hp</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">drat</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">wt</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">qsec</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">vs</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">am</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">gear</th> #> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">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)