Skip to content

Instantly share code, notes, and snippets.

@dohyunkim
Last active July 31, 2026 08:38
Show Gist options
  • Select an option

  • Save dohyunkim/3bba58f7ff7cb164faee53b2edde9ee2 to your computer and use it in GitHub Desktop.

Select an option

Save dohyunkim/3bba58f7ff7cb164faee53b2edde9ee2 to your computer and use it in GitHub Desktop.
color wheel mimicking mac color select
\documentclass[margin=5pt]{standalone}
\usepackage{luamplib}
\begin{document}
\mpfig
u := 100;
color yellow; yellow = (1, 1, 0);
color cyan; cyan = (0, 1, 1);
color magenta; magenta = (1, 0, 1);
path p, q;
p = (for i=0 upto 11: dir 30i .. endfor cycle) scaled u;
q = origin -- subpath(0, 2) of p -- cycle;
fill p
withshadingmethod "coons"
withcoonspatchinit (q rotated 0, white, red, 1/2[red,yellow], yellow )
withcoonspatchinit (q rotated 60, white, yellow, 1/2[yellow,green], green )
withcoonspatchinit (q rotated 120, white, green, 1/2[green,cyan], cyan )
withcoonspatchinit (q rotated 180, white, cyan, 1/2[cyan,blue], blue )
withcoonspatchinit (q rotated 240, white, blue, 1/2[blue,magenta], magenta)
withcoonspatchinit (q rotated 300, white, magenta, 1/2[magenta,red], red )
;
\endmpfig
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment