[pgf-tikz] what's the basic layer equivalent of \pgfsys at color@rgb
Henri Menke
henri at henrimenke.de
Tue Dec 13 11:42:18 CET 2022
On Sun, 2022-12-11 at 15:58 +0100, Tamas Papp wrote:
> On v, dec 11 2022, Henri Menke via pgf-tikz wrote:
>
> > On Sun, 2022-12-11 at 08:47 +0100, Tamas Papp wrote:
> > > Hi,
> > >
> > > If I have a color specified as RGB, with a floating point number
> > > for
> > > each channel between 0 and 1, what's the exposed API to set this
> > > with
> > > the basic layer? (as stroke, fill, or both).
> >
> > \definecolor{mycolor}{rgb}{<r>,<g>,<b>}
> > \pgfsetcolor{mycolor}
>
> Thanks for the quick response. Two questions:
>
> 1. So can I recycle mycolor multiple times, for time I need a color
> set?
I suppose so. That's how people normally make figures in TikZ by hand.
> 2. Is there a difference between the above and
>
> \pgfsetcolor{rgb,1:red,<r>;green,<g>;blue,<b>}
>
> for speed, memory, or any other relevant aspect? I am wondering if
> the
> above involves a division or not (by 1, but that is still a
> division).
Probably yes, but I can't say anything about performance. Generally
performance can only be assessed by benchmarking. When using pdfTeX use
\pdfelapsedtime
\pdfresettimer
for that. Here is an example how to use those:
https://github.com/circuitikz/circuitikz/commit/00966c45c42b464fab5429f89f2b7fb414e9b3f7#commitcomment-54592494
Cheers, Henri
>
> best,
>
> Tamas
More information about the pgf-tikz
mailing list.