This is a workaround since LyX does not support the package colortbl
at the moment. Please check below steps carefully!
Add \usepackage{colortbl}
to the LaTeX Preamble (under "Document > Settings").
Coloring the top rule
To color the top rule in "blue" put the TeX code/ERT \arrayrulecolor{blue}\hline
at the beginning of the first table cell. (If the colored rule did not completely cover original rule you needed to remove the top rule in the LyX table editor.)
Coloring another horizontal rule
To color a rule below a certain table row in "red" put \tabularnewline\arrayrulecolor{red}%
at the end of the last cell of that row.
Please check the result by using "View Source". The trick is that by using %
we make the remaining line a comment. Everything that we make a comment (that is, comes after the %
) must be repeated by us in front of \arrayrulecolor
.
For example, if a concerned line ends with \tabularnewline
, we will put exactly this in front of \arrayrulecolor
, that is, we write \tabularnewline[4ex]\arrayrulecolor{red}%
. Or, if the line ends with \tabularnewline[4ex]
then we have to put the TeX code \tabularnewline[4ex]\arrayrulecolor{red}%
.
Finally, we might want to reset the color to "black" as describe in previous case.
Following all above steps we get a table like this:
The output is:
Note that you can close a TeX code inset by right click "Close Inset":
\arrayrulecolor
command.