Been doing some reading.
See below which adds to RonJons code from a couple of years ago. I've referenced a couple of the posts I looked at for reference. The third one is quite good to keep handy - a complete list of vla- fuctions.
I've put a couple of notes in the code, see how this is for you.
;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/tablestyle-text-color/td-p/9142019
;https://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-7B82400C-53D0-4D1A-94FA-66BB3040F0AA
;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/complete-list-of-vl-vla-and-vlax-functions/td-p/4666405
;https://help.autodesk.com/view/OARX/2019/ENU/?guid=GUID-DF80B4AB-0481-4702-967F-021B4F59AD9F
(defun c:foo (/ co e el o col)
;; RJP » 2019-11-12
(cond ((and (setq e (car (entsel)))
(= "ACAD_TABLE" (cdr (assoc 0 (setq el (entget e)))))
(setq co (vla-get-truecolor (vlax-ename->vla-object e)))
(setq o (cdr (assoc 342 el)))
)
;;Text Colours
(vla-put-colorindex co 12)
(vla-setcolor (setq o (vlax-ename->vla-object o)) actitlerow co)
(vla-put-colorindex co 11)
(vla-setcolor o acheaderrow co)
(vla-put-colorindex co 256)
(vla-setcolor o acdatarow co)
;;Cell Colours:
;;Create a colour object
(setq col (vlax-create-object (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))))
;;Setting the table background colours
(vla-SetRGB col 240 0 240) ; set the true colour;
;;In the row below note the (+ ac..... ) which is what row types to include
(vla-SetBackgroundColor o (+ acTitleRow acHeaderRow acDataRow) col) ;; colour row types
;; Clear the background colors
(vla-SetBackgroundColorNone o (+ acTitleRow acHeaderRow acDataRow) :vlax-true) ; no colour in row types
;; Set the border color
(vla-SetRGB col 12 34 56) ; set the colour
;;Note 1 you can also do each row type individually (2 rows here) or combined as above (row 1 below)
;;Note 2 the (+ acHorzTop.....) which is which border to adjust
(vla-SetGridColor o (+ acHorzTop acHorzBottom acHorzInside acVertLeft acVertRight acVertInside) (+ acHeaderRow acTitleRow) col)
;;Note here that you can use the colour object, col, or the colour index (from RonJon), co.
(vla-put-colorindex co 256) ; 0 for ByBlock, 256 for ByLayer
(vla-SetGridColor o (+ acHorzTop acHorzBottom acHorzInside acVertLeft acVertRight acVertInside) (+ acDataRow ) co)
;; Release the color object
(vlax-release-object col)
) ; end cond
) ; end conds
)