Skip to content

Commit

Permalink
Merge pull request #1130 from gucci-on-fleek/master
Browse files Browse the repository at this point in the history
Add support for `RGB` color model in ConTeXt
  • Loading branch information
hmenke authored Apr 15, 2024
2 parents 3007c42 + 73c697c commit 913d955
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/generic/pgf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

- Add `RGB` and `gray` color model support for ConTeXt #1130

### Fixed

- Typo in animations `end on` key #1273
Expand Down Expand Up @@ -37,6 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Rocky Zhang (@rockyzhz)
- Yukai Chou (@muzimuzhi)
- Alexander Grahn
- Max Chernoff

## [3.1.10] - 2023-01-13 Henri Menke

Expand Down
11 changes: 10 additions & 1 deletion tex/generic/pgf/utilities/pgfutil-context.def
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@
\def\pgfutil@definecolor#1#2#3{\csname pgfutil@emu@#2\endcsname{#1}#3\@nil}

\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@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{gray}{#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 913d955

Please sign in to comment.