diff options
author | Norbert Preining <norbert@preining.info> | 2020-12-26 03:02:09 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-12-26 03:02:09 +0000 |
commit | 7ae913a662e817e559620e1114b63e0f412ff2e3 (patch) | |
tree | 96a6fab8955d0a1a5632599d839a1006290a2930 /graphics/pgf/contrib/puyotikz/puyotikz.sty | |
parent | 41eb4dfa0badd165fc762b85c3ba592b4e57d38a (diff) |
CTAN sync 202012260302
Diffstat (limited to 'graphics/pgf/contrib/puyotikz/puyotikz.sty')
-rw-r--r-- | graphics/pgf/contrib/puyotikz/puyotikz.sty | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/puyotikz/puyotikz.sty b/graphics/pgf/contrib/puyotikz/puyotikz.sty new file mode 100644 index 0000000000..4a5c4dd200 --- /dev/null +++ b/graphics/pgf/contrib/puyotikz/puyotikz.sty @@ -0,0 +1,64 @@ +% PuyoTikZ package for LaTeX. +% Created by amosborne (GitHub) / terramyst (Twitter). +% MIT License + +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{puyotikz}[2020/12/23 v1.0.0 PuyoTikZ] + +\RequirePackage{pythontex} +\RequirePackage{tikz} +\RequirePackage{keyval} + +\pyc{import puyotikz as puyo} + +\def\puyosmallscale{0.34} +\def\puyobigscale{0.65} + +\newenvironment{puyotikz}[1][\puyobigscale] + {\begin{tikzpicture}[scale=#1, every node/.style={transform shape}]} + {\end{tikzpicture}} + +\define@key{puyoboard}{ncols}{\def\puyo@ncols{#1}} +\define@key{puyoboard}{nrows}{\def\puyo@nrows{#1}} +\define@key{puyoboard}{nhidrows}{\def\puyo@nhidrows{#1}} +\define@key{puyoboard}{showlabels}{\def\puyo@showlabels{#1}} +\setkeys{puyoboard}{ncols=6, nrows=12, nhidrows=1, showlabels=True} + +\setpythontexcontext{ + ncols=\puyo@ncols, + nrows=\puyo@nrows, + nhidrows=\puyo@nhidrows, + showlabels=\puyo@showlabels +} + +\newcommand{\puyoboard}[3][]{ + \setkeys{puyoboard}{#1} + \pyc{puyo.puyoboard(cols=int(pytex.context.ncols), % + rows=int(pytex.context.nrows), % + hrows=int(pytex.context.nhidrows), % + boardpuyos="#2", % + nextpuyos="#3", % + label=pytex.context.showlabels=="True")} +} + +\newcommand{\puyomarker}[1]{\pyc{puyo.puyomarker("#1")}} + +\newcommand{\puyogrid}[2][]{ + \setkeys{puyoboard}{nhidrows=0, showlabels=False} + \begin{puyotikz}[\puyosmallscale] + \puyoboard[#1]{#2}{} + \end{puyotikz} +} + +\newcommand{\puyocolor}[2]{ + \definecolor{#1puyo}{RGB}{#2} + \colorlet{dark#1puyo}{#1puyo!80!black} +} +\puyocolor{red}{255,82,98} +\puyocolor{green}{82,213,98} +\puyocolor{blue}{32,115,213} +\puyocolor{yellow}{255,220,24} +\puyocolor{purple}{131,90,213} +\puyocolor{gray}{180,172,189} + +\endinput |