I am working with some data where I need columns of a table to have background colors based on a comparison of the name of the column to a value in another table. The first table has columns '1' through '21' representing the days of the work month (Mondays through Fridays) and has two rows for counted and uncounted item stock. The first table would be compared to a value in another table which is created to calculate the current actual day of the work month. (Both tables are created using SQL queries which cannot be changed unfortunately)
If everything works properly, when the second table returns '5', the '5' column of the first table will have a green background and columns '6' through '10' will have light blue backgrounds to highlight the current day of the work month and the following 5 days as the highlighted outputs of table 1.
I have trying reworking ideas from the stack overflow questions below but have thus far been unsuccessful:
Conditionally fill cells in specific columns with colour based on value in another column
Any suggestions would be greatly appreciated!
edit: the table will be rendered in a r markdown document. The challenge is making the column background color change conditional on the column name matching a value. All of the available solutions look to match the values of the column instead of the name of the column.