Skip to contents

This function styles rows in a gt table based on win/loss results. It allows customization of colors and text for win and loss rows. Users can specify the column with result data, customize colors, and choose between traditional win/loss or binary result types.

Usage

gt_color_results(
  gt_object,
  result_column = "result",
  win_color = "#5DA271",
  loss_color = "#C84630",
  wins_text_color = "white",
  loss_text_color = "white",
  result_type = "wl"
)

Arguments

gt_object

A gt table object.

result_column

The name of the column in data that contains the result indicators. Default is 'result'.

win_color

The background color for rows indicating a win. Default is '#5DA271' (green).

loss_color

The background color for rows indicating a loss. Default is '#C84630' (red).

wins_text_color

The text color for rows indicating a win. Default is 'white'.

loss_text_color

The text color for rows indicating a loss. Default is 'white'.

result_type

The type of result indicators used in the result_column. Options are 'wl' (default, for 'W' and 'L') or 'binary' (for 1 and 0).

Value

A gt table with styled rows based on the win/loss results.