# Colour definition in LaTeX- xcolor.sty, svgnam.def, and \definecolor

I'm looking for the best way to define a new colour in LaTeX using the different methods above. In xcolor.sty, I have

\definecolorset{gray/rgb/hsb/cmyk}{}{}%
{black,0/0,0,0/0,0,0/0,0,0,1;%
darkgray,.25/.25,.25,.25/0,0,.25/0,0,0,.75;%
gray,.5/.5,.5,.5/0,0,.5/0,0,0,.5;%
lightgray,.75/.75,.75,.75/0,0,.75/0,0,0,.25;%
white,1/1,1,1/0,0,1/0,0,0,0}


And in svgnam.def I have

\def\colornameprefix{XC@}
\preparecolorset{rgb}{}{}{%
AliceBlue,.94,.972,1;%
AntiqueWhite,.98,.92,.844;%
Aqua,0,1,1;%
\endinput


I want to define a new colour LightBlue directly in my document, but the following R code does not work. Since the white text shows up where it is supposed to, the error must be in the definition of LightBlue:

\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\definecolor{LightBlue}{RGB}{126,160,216}

2  Deletion     2
3  UpWeight     3

for(i in 1:nrow(temp)){
if(nrow(temp)>0){
temp[,1:ncol(temp)]<-"{\\cellcolor{LightBlue}\\textcolor{white}{  }}"
temp[,2]<-paste0("{\\cellcolor{LightBlue}\\textcolor{white}{to test}}")
temp\$Action<-NULL
}
}


So my questions are:

1. Is there an error in my current definition?
2. Should I directly define LightBlue in svgnam.def to avoid converting to the four different colour schemes in xcolor.sty?
3. Does {RGB} use a scale from 0 to 255 while {rgb} goes from 0 to 1? If so, would the conversion to {rgb} be as easy as dividing each {RGB} value by 255?

Thank you!

• You've called the colour RBCLightBlue – Joseph Wright Jun 22 '17 at 14:39
• Oops, it's defined as LightBlue in the document but I copied the wrong line over in my minimal example- thanks for the catch! – Anna Jun 22 '17 at 14:40
• @Anna What error message do you get? – samcarter_is_at_topanswers.xyz Jun 22 '17 at 14:42
• I don't get an error message, but I get the text "LightBlue" in the cell where is it supposed to be coloured LightBlue instead. For the text "to test", it correctly shows up in white. – Anna Jun 22 '17 at 14:44
• You should first get it working in a latex document without R and once that is working you can check the R code is generating the correct tex. – David Carlisle Jun 22 '17 at 18:49