add text & background color option in column_spec & row_spec as #43
diff --git a/R/column_spec.R b/R/column_spec.R
index 8381899..e13e685 100644
--- a/R/column_spec.R
+++ b/R/column_spec.R
@@ -23,7 +23,7 @@
 #' @export
 column_spec <- function(kable_input, column,
                         width = NULL, bold = FALSE, italic = FALSE,
-                        monospace = FALSE) {
+                        monospace = FALSE, color = NULL, background = NULL) {
   if (!is.numeric(column)) {
     stop("column must be a numeric value")
   }
@@ -33,14 +33,20 @@
     return(kable_input)
   }
   if (kable_format == "html") {
-    return(column_spec_html(kable_input, column, width, bold, italic, monospace))
+    return(column_spec_html(kable_input, column, width,
+                            bold, italic, monospace,
+                            color, background))
   }
   if (kable_format == "latex") {
-    return(column_spec_latex(kable_input, column, width, bold, italic, monospace))
+    return(column_spec_latex(kable_input, column, width,
+                             bold, italic, monospace,
+                             color, background))
   }
 }
 
-column_spec_html <- function(kable_input, column, width, bold, italic, monospace) {
+column_spec_html <- function(kable_input, column, width,
+                             bold, italic, monospace,
+                             color, background) {
   kable_attrs <- attributes(kable_input)
   kable_xml <- read_kable_as_xml(kable_input)
   kable_tbody <- xml_tpart(kable_xml, "tbody")
@@ -79,6 +85,15 @@
       xml_attr(target_cell, "style") <- paste0(xml_attr(target_cell, "style"),
                                                "font-family: monospace;")
     }
+    if (!is.null(color)) {
+      xml_attr(target_cell, "style") <- paste0(xml_attr(target_cell, "style"),
+                                               "color: ", color, ";")
+    }
+    if (!is.null(background)) {
+      xml_attr(target_cell, "style") <- paste0(xml_attr(target_cell, "style"),
+                                               "background-color: ",
+                                               background, ";")
+    }
   }
   out <- as_kable_xml(kable_xml)
   attributes(out) <- kable_attrs