Skip to content

Commit

Permalink
Add support for RGB color model in ConTeXt
Browse files Browse the repository at this point in the history
Copied from `tex/generic/pgf/utilities/pgfutil-plain.def:29-37`

Signed-off-by: Max Chernoff <[email protected]>
  • Loading branch information
gucci-on-fleek committed Jan 28, 2022
1 parent 4cba1da commit d6fb8fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/generic/pgf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ lot of contributed changes. Thanks to everyone who volunteered their time!
#1112
- Form-only patterns have no specified color #1122
- Make `graphdrawing` work with `name prefix` and `name suffix` options #1087
- Add `RGB` color model support for ConTeXt

### Changed

Expand All @@ -82,6 +83,7 @@ lot of contributed changes. Thanks to everyone who volunteered their time!
- Jonathan Spratte
- Joseph Wright
- Mario Frasca
- Max Chernoff
- Michael Kuron
- Michal Hoftich
- muzimuzhi
Expand Down
9 changes: 9 additions & 0 deletions tex/generic/pgf/utilities/pgfutil-context.def
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}}
\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}}
\def\pgfutil@emu@cmyk#1#2,#3,#4,#5\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{cmyk}{#2,#3,#4,#5}}}
\def\pgfutil@emu@RGB#1#2,#3,#4\@nil{%
\begingroup
\pgfmathdivide@{#2}{255}\let\pgfutil@emu@RGB@r\pgfmathresult
\pgfmathdivide@{#3}{255}\let\pgfutil@emu@RGB@g\pgfmathresult
\pgfmathdivide@{#4}{255}\let\pgfutil@emu@RGB@b\pgfmathresult
\edef\pgf@marshal{\def\expandafter\noexpand\csname\string\color@#1\endcsname{%
\noexpand\xcolor@{}{}{rgb}{\pgfutil@emu@RGB@r,\pgfutil@emu@RGB@g,\pgfutil@emu@RGB@b}}}%
\expandafter\endgroup\pgf@marshal
}


% no need for x colors (users can load it if needed)
Expand Down

0 comments on commit d6fb8fb

Please sign in to comment.