Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB colour model for plain TeX users #772

Closed
hmenke opened this issue Nov 8, 2019 · 4 comments
Closed

RGB colour model for plain TeX users #772

hmenke opened this issue Nov 8, 2019 · 4 comments

Comments

@hmenke
Copy link
Member

hmenke commented Nov 8, 2019

From the mailing list:

Hi,

In Section 15.2 of the manual it says (under the "For plain TeX users"
paragraph)
        Only the two color models gray and rgb are supported.

In .../texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def it
defines the macros
        \pgfutil@emu@rgb#1#2,#3,#4\@nil
and
        \pgfutil@emu@gray#1#2,#3,#4\@nil

I have used the following to implement the RGB model:

\def\pgfutil@emu@RGB#1#2,#3,#4\@nil
{
    \pgfmathsetmacro{\@red@}{#2/255}%
    \pgfmathsetmacro{\@green@}{#3/255}%
    \pgfmathsetmacro{\@blue@}{#4/255}%
    \expandafter\edef\csname\string\color@#1\endcsname
        {\noexpand\xcolor@ {}{}{rgb}{\@red@,\@green@,\@blue@}}
}

and it works in all the cases I have tried.

Is there any chance of having this code (or better, but equivalent code)
added to pgfutil-plain.def, and the note in Section 15.2 of the manual
updated?

Thanks.

                                Jim
@hmenke hmenke added this to the 3.1.5 milestone Nov 8, 2019
@Ndolam
Copy link

Ndolam commented Nov 9, 2019

Hi again Henri,

I will also put this on github, but a couple of minutes of playing
around gave me

\def\pgfutil@emu@cmyk#1#2,#3,#4,#5\@nil
{
    \pgfmathsetmacro{\@red@}{(1 - #2) * (1 - #5)}%
    \pgfmathsetmacro{\@green@}{(1 - #3) * (1 - #5)}%
    \pgfmathsetmacro{\@blue@}{(1 - #4) * (1 - #5)}% 
    \expandafter\edef\csname\string\color@#1\endcsname
    {\noexpand\xcolor@ {}{}{rgb}{\@red@,\@green@,\@blue@}}
}

I realize that converting cmyk to rgb is a lot more contentious than
converting RGB to rgb, but in case anyone aside from me thinks this is
more useful than harmful, ...

Cheers.
Jim

@hmenke
Copy link
Member Author

hmenke commented Nov 10, 2019

Hmmm... Conversion of RGB to CMYK depends on the used color profile. I don't know what xcolor does but your proposal seems a bit too naive.

@Ndolam
Copy link

Ndolam commented Nov 10, 2019 via email

@hmenke
Copy link
Member Author

hmenke commented Nov 12, 2019

Support for RGB has been added. 8a558df

@hmenke hmenke closed this as completed Nov 12, 2019
gucci-on-fleek added a commit to gucci-on-fleek/pgf that referenced this issue Feb 6, 2022
The `RGB` support was copied from the the Plain TeX definitions,
`tex/generic/pgf/utilities/pgfutil-plain.def:29-37`, which is from pgf-tikz#772.

The `gray` color model now maps to the grayscale and not to `rgb`.

Signed-off-by: Max Chernoff <49086429+gucci-on-fleek@users.noreply.github.com>
gucci-on-fleek added a commit to gucci-on-fleek/pgf that referenced this issue Feb 6, 2022
The `RGB` support was copied from the the Plain TeX definitions,
`tex/generic/pgf/utilities/pgfutil-plain.def:29-37`, which is from pgf-tikz#772.

The `gray` color model now maps to the grayscale and not to `rgb`.

Signed-off-by: Max Chernoff <49086429+gucci-on-fleek@users.noreply.github.com>
gucci-on-fleek added a commit to gucci-on-fleek/pgf that referenced this issue Apr 14, 2024
The `RGB` support was copied from the the Plain TeX definitions,
`tex/generic/pgf/utilities/pgfutil-plain.def:29-37`, which is from pgf-tikz#772.

The `gray` color model now maps to the grayscale and not to `rgb`.

Signed-off-by: Max Chernoff <49086429+gucci-on-fleek@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants