groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Colors with gropdf


From: Deri James
Subject: Re: [Groff] Colors with gropdf
Date: Fri, 25 Nov 2016 13:02:55 +0000
User-agent: KMail/4.14.5 (Linux/4.4.30-desktop-2.mga5; KDE/4.14.5; x86_64; ; )

On Fri 25 Nov 2016 16:47:26 Robert Marks wrote:
> I have recently had to embed a PDF image in a groff document and so have
> been using
> groff -Tpdf
> to do so.
> But I find that my \m[red] etc color commands are not recognised (and there
> are error messages..
> Some work on Google led me to the Ubuntu gropdf manual, which states:
> 
>  The  default  color  for  \m and \M is black; for colors defined in the
>        ‘rgb’  color  space  setrgbcolor  is  used,  for   ‘cmy’   and
> ‘cmyk’
>        setcmykcolor,  and  for  ‘gray’  setgray.   Note that setcmykcolor
> is a
>        PostScript LanguageLevel 2 command and thus not available on some
> older
>        printers.
> 
> Searching for setrgbcolor tells me that it's a PS commend to be used:
> .ds RED \X'ps: exec 1 0 0 setrgbcolor'
> and then referring to \*[RED] to change the color from black, say.
> 
> But there is no change (and no error messages). Using groff 1.22.2
> 
> Any advice on using color in gropdf or groff -Tpdf ?
> 
> Thanks,
> 
> Bob

The information you found in the gropdf is wrong, it got left in erroneously 
from the grops manual, upon which it was based. I have removed it now. The 
correct way to use colour in groff is described in the info page as:-

 -- Request: .defcolor ident scheme color_components
     Define color with name IDENT.  SCHEME can be one of the following
     values: 'rgb' (three components), 'cmy' (three components), 'cmyk'
     (four components), and 'gray' or 'grey' (one component).

     Color components can be given either as a hexadecimal string or as
     positive decimal integers in the range 0-65535.  A hexadecimal
     string contains all color components concatenated.  It must start
     with either '#' or '##'; the former specifies hex values in the
     range 0-255 (which are internally multiplied by 257), the latter in
     the range 0-65535.  Examples: '#FFC0CB' (pink), '##ffff0000ffff'
     (magenta).  The default color name value is device-specific
     (usually black).  It is possible that the default color for '\m'
     and '\M' is not identical.

     A new scaling indicator 'f' has been introduced, which multiplies
     its value by 65536; this makes it convenient to specify color
     components as fractions in the range 0 to 1 (1f equals 65536u).
     Example:

          .defcolor darkgreen rgb 0.1f 0.5f 0.2f

     Note that 'f' is the default scaling indicator for the 'defcolor'
     request, thus the above statement is equivalent to

          .defcolor darkgreen rgb 0.1 0.5 0.2

Also note that many colours have been pre-defined if you are using grops or 
gropdf all the colours shown in the attached file have already been defined, so 
you can just use the name in your \m[] and \M[].

Attachment: GroffColours.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]