[Tex/LaTex] How to change/add column background colors in Lyx? I can easily change/add colors of rows, but not columns

colorcolumnslyxtables

Bear with me, this isn't a duplicate question. I can successfully change the row color in tables using the instructions here: http://wiki.lyx.org/LyX/Tables

(A similar question exists here: Background for table cells in LyX)

But when I add the command \columncolor{cyan}, it throws up some errors. The working example provided on the website has one of the columns colored in green, but I have no idea how they did it, since the command isn't present in the main editor (but it shows up in the source!).

Keep in mind I want to do this using LyX and don't want LaTeX code (which is already out there).

Best Answer

First, you need to put the \usepackage{colortbl} package in your preamble. Then put the curser in the column where you want to change the background color. Then right click and go to more -> settings

Now, under LaTeX Argument: you have to put the following

>{\columncolor{darkgreen}\centering}c

where the darkgreen can be changed to any valid LaTeX color and c can be changed to a table alignment. I.e. l,r,c etc.