Skip to content

Commit 913d955

Browse files
authored
Merge pull request pgf-tikz#1130 from gucci-on-fleek/master
Add support for `RGB` color model in ConTeXt
2 parents 3007c42 + 73c697c commit 913d955

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

doc/generic/pgf/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1010

1111
### Added
1212

13+
- Add `RGB` and `gray` color model support for ConTeXt #1130
14+
1315
### Fixed
1416

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

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

tex/generic/pgf/utilities/pgfutil-context.def

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,17 @@
2626
\def\pgfutil@definecolor#1#2#3{\csname pgfutil@emu@#2\endcsname{#1}#3\@nil}
2727

2828
\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}}
29-
\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}}
29+
\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{gray}{#2}}}
3030
\def\pgfutil@emu@cmyk#1#2,#3,#4,#5\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{cmyk}{#2,#3,#4,#5}}}
31+
\def\pgfutil@emu@RGB#1#2,#3,#4\@nil{%
32+
\begingroup
33+
\pgfmathdivide@{#2}{255}\let\pgfutil@emu@RGB@r\pgfmathresult
34+
\pgfmathdivide@{#3}{255}\let\pgfutil@emu@RGB@g\pgfmathresult
35+
\pgfmathdivide@{#4}{255}\let\pgfutil@emu@RGB@b\pgfmathresult
36+
\edef\pgf@marshal{\def\expandafter\noexpand\csname\string\color@#1\endcsname{%
37+
\noexpand\xcolor@{}{}{rgb}{\pgfutil@emu@RGB@r,\pgfutil@emu@RGB@g,\pgfutil@emu@RGB@b}}}%
38+
\expandafter\endgroup\pgf@marshal
39+
}
3140

3241

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

0 commit comments

Comments
 (0)