I'm fiddling with source code display (Objective-C) and the listings package. I want to colour comments the same green that appears in XCode. I determined that it has an RGB value of 67, 133, 34. To use this I need to divide by 255 since this is the format/value range of input parameters to
\definecolor{green}{rgb}{0.34,0.52,0.14}
Is there any way to write a macro in latex that divides by 255? Thanks.
In response to comment:
If I do
\usepackage{listings} % For source code display.
\usepackage{courier} % For source code display.
\usepackage{xcolor}
\lstset{basicstyle=\footnotesize\ttfamily}
\lstset{language=[Objective]C}
\definecolor{green}{rgb}{67,133,34}
\lstset{commentstyle=\color{green}}
instead of
\usepackage{listings} % For source code display.
\usepackage{courier} % For source code display.
\usepackage{color}
\lstset{basicstyle=\footnotesize\ttfamily}
\lstset{language=[Objective]C}
\definecolor{green}{rgb}{0.34,0.52,0.14}
\lstset{commentstyle=\color{green}}
the comment in my source code listing vanishes.
xcolor
package you can use\definecolor{mygreen}{RGB}{67,133,34}
– egreg Mar 13 '13 at 17:06RGB
) to define colours using values from 0-255. – Jake Mar 13 '13 at 17:11green
, also. – egreg Mar 13 '13 at 17:12