% !TeX TS-program = pdflatex

\documentclass[svgnames]{report}
\usepackage{wordle}
\usepackage{manfnt}
\usepackage{enumitem}
\setlist[description]{font=\sffamily\bfseries\color{ForestGreen},labelwidth=\textwidth}
\usepackage{booktabs}
\usepackage[a4paper,margin=18mm]{geometry}
\synctex=1
\parindent=0pt
\parskip=2mm

\usepackage[T1]{fontenc} % precomposed glyphs, so diacritics copy correctly from the PDF
\setcounter{secnumdepth}{0}

\usepackage{listings}\lstset{language=[LaTeX]TeX,framerule=2pt}
\lstset{language=[LaTeX]TeX,
        texcsstyle=*\bfseries\color{Peru},
        backgroundcolor=\color{Ivory},
        numbers=none,
        breaklines=true,
        keywordstyle=\color{Sienna},
        commentstyle=\color{BurlyWood},
        tabsize=2,
        morekeywords={Wordle,wordle,GrilleSutom},
        resetmargins=true,
}
% hyperref links to ctan
\newcommand\ctan[1]{\href{https://www.ctan.org/pkg/#1}{\texttt{#1}}}

\newcommand\Section[1]{\subsection{\textcolor{DarkGreen}{#1}}}

\ExplSyntaxOn
\NewDocumentCommand\option{ omo }{%
  \IfNoValueTF{#1}{\textsf{#2}}
  {%
    \textbf{\textcolor{Crimson}{#2}}
    \str_if_empty:nF {#1}{~(default:~\textcolor{DarkRed}{#1})}%
    \IfNoValueF{#3}{\hfill\textcolor{Gray}{[accepts:~#3]}}%
  }%
  \index{#2}%
}
\ExplSyntaxOff

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{imakeidx}
\indexsetup{level=\section*, toclevel=section, noclearpage}
\makeindex[intoc,columns=3]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[skins,listings]{tcolorbox}
\usetikzlibrary{backgrounds, shapes.geometric} % for tikz={framed,...}

\DeclareTotalTCBox\keyword{ O{} v }{
  fontupper=\sffamily,
  nobeforeafter,
  skin=tile,
  verbatim,
  on line,
  tcbox raise base,
  top=0pt,bottom=0pt,left=0mm,right=0mm,
  colback=OldLace,
  colupper=ForestGreen,
  #1}
{#2}

\lstdefinestyle{tikz}{style=tcblatex,
  classoffset=0,
  texcsstyle=*\color{DarkGoldenrod},%
  deletetexcs={begin, end},
  moretexcs={,%
    node,
    draw,
    true,
    false
  },%
  classoffset=1,
  keywordstyle=\color{ForestGreen},%
  morekeywords={wordle,GrilleSutom},
  classoffset=2,
  keywordstyle=\color{Crimson},%
  morekeywords={
    absent,
    align,
    border,
    borders,
    case,
    color,
    colors,
    colour,
    colours,
    correct,
    empty,
    font,
    frame,
    frames,
    letters,
    lower,
    name,
    natural,
    noalign,
    noletters,
    params,
    present,
    rounded,
    rows,
    scale,
    sensitive,
    separation,
    shape,
    shapes,
    size,
    strict,
    style,
    style,
    text,
    thickness,
    tikz,
    tile,
    upper,
  },
  classoffset=3,
  keywordstyle=\color{DarkOrange},%
  morekeywords={
    hard,
    standard,
    sutom,
  }
}

\DeclareTCBListing{example}{ !O{} }{%
  skin=bicolor,
  colframe=MediumSeaGreen,
  colbacklower=OldLace,
  colback=LawnGreen!20,
  lefthand width=50mm,
  listing style=tikz,
  sidebyside,
  sidebyside align=center,
  sidebyside gap=4mm,
  text and listing,
  text outside listing,
  boxsep = 0pt,
  #1
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\makeatletter
\author{Andrew Mathas and Cédric Pierquet}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\tikzset{shadowed/.style={blur shadow={shadow blur steps=5},
                          bottom color=ForestGreen!30,
                          draw=MediumSeaGreen!70,
                          shade,
                          font=\normalfont\Huge\bfseries\scshape,
                          rounded corners=8pt,
                          top color=SeaGreen,
      },
      boxes/.style={draw=SeaGreen,
                    fill=Cornsilk,
                    font=\sffamily\small,
                    inner sep=5pt,
                    rectangle,
                    rounded corners=8pt,
                    text=DarkGreen,
     }
}
\newcommand\Wordle{%
  \begin{tikzpicture}[remember picture,overlay]
      \node[yshift=-3cm] at (current page.north west)
        {\begin{tikzpicture}[remember picture, overlay]
          \draw[shadowed](30mm,0) rectangle node[white]{wordle} (\paperwidth-30mm,16mm);
          \node[anchor=west,boxes] at (4cm,0cm) {\@author};
          \node[anchor=east,boxes] at (\paperwidth-4cm,0) {Version \wordle@version};
         \end{tikzpicture}
        };
   \end{tikzpicture}
   \vspace*{20mm}
}

\def\@oddfoot{\textsc{Wordle} --- \wordle@version~(released~\wordle@release)\hfill\thepage}

\usepackage[colorlinks=true,linkcolor=blue,urlcolor=MediumBlue]{hyperref}
\hypersetup{
  pdfcreator={ Generated by pdfLaTeX },
  pdfinfo={
    Author  ={ Andrew Mathas and Cédric Pierquet},
    Keywords={ wordle },
    License ={ LaTeX Project Public License v1.3c or later },
    Subject ={ LaTeXing Wordle puzzles },
    Title   ={ Wordle - \wordle@version }
  },
}
\makeatother

\begin{document}

  \Wordle

  This package provides a stupidly feature-rich way of creating
  \keyword{Wordle} puzzles in \LaTeX, which
  \href{https://en.wikipedia.org/wiki/Wordle}{Wikipedia} describes as a
  hugely popular web-based word game created and developed by Welsh
  software engineer Josh Wardle. This package is an enhanced version of
  one of the solutions to a question asked by \textcolor{FireBrick}{valerio\_new}
  on
  \href{https://tex.stackexchange.com/questions/659860/wordle-like-colored-letter-boxes-in-latex/660056#660056}{tex.stackexchange.com}.

  This package provides the \keyword{wordle} environment, which uses the
  syntax:

  \begin{tcblisting}{
    listing only,
    skin=bicolor,
    colframe=MediumSeaGreen,
    colbacklower=OldLace,
    colback=LawnGreen!20,
    listing style=tikz,
    boxsep = 0pt,
  }
  % \usepackage{wordle}
  \begin{wordle}[wordle settings]{solution}[optional tikz commands]
    guess1 guess2 ...
  \end{wordle}
  \end{tcblisting}
  \index{environment!wordle}
  \index{wordle}

  and the \keyword{GrilleSutom} environment, for \keyword{Sutom}, the French version of
  the game:

  \begin{tcblisting}{
    listing only,
    skin=bicolor,
    colframe=MediumSeaGreen,
    colbacklower=OldLace,
    colback=LawnGreen!20,
    listing style=tikz,
    boxsep = 0pt,
  }
  % \usepackage{wordle}
  \begin{GrilleSutom}[sutom settings]{solution}[optional TikZ commands]
    guess1 guess2 ...
  \end{GrilleSutom}
  \end{tcblisting}
  \index{environment!GrilleSutom}
  \index{GrilleSutom}
  \index{sutom}

  The words in the puzzle can be entered on a single line, or on separate
  lines.  Here are some examples:

  \begin{example}
  \begin{wordle}{ANVIL}
    % English version of sutom (wordle)
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  \begin{example}
  % French version of wordle (sutom)
  \begin{GrilleSutom}{REBUS}
    ABRIS
    ROUTE
    REBUS
  \end{GrilleSutom}
  \end{example}

  As in the online puzzles, the \keyword{wordle} environment
  automatically colours the letter tiles
  \keyword[colback=WordleCorrect,colupper=White]{green}
  when the letter is in the same position as the solution, and as
  \keyword[colback=WordlePresent,colupper=White]{gold} when
  the letter is in the solution but it is not in the correct position.
  Similarly, \keyword{GrilleSutom} colours the correct letters
  \keyword[colback=WordleSutomCorrect,colupper=White]{red}
  and the present letters
  \keyword[colback=WordleSutomPresent,colupper=White]{gold}.
  As described below, these colours can be changed to suit your tastes.

  The number of letters in the puzzle is determined by the solution,
  being constrained only by the page width.

  \begin{example}
  \begin{wordle}[rows=4]{orange}
     normal
     orders
     orange
  \end{wordle}
  \end{example}

  The letters in the puzzle can be entered in upper case, lower case, or
  mixed case. By default, the case of the letters is ignored when
  determining the colours of the letter tiles.

  As described below, the \keyword{wordle} and \keyword{GrilleSutom}
  environments accept an array of different options that change the
  colours, fonts, and shapes of the tile. In addition, you can change
  whether the package environments are case sensitive, add extra rows to the
  puzzle, disable special formatting of the \textit{letter tiles}.
  These options are given as a comma separated list of key-value pairs.
  They can be set locally, using the optional argument of the
  \keyword|wordle| environment, or they can be set globally (more
  accurately, in the current \LaTeX\ group) using the
  \keyword{\WordleSetup} command \index{\textbackslash WordleSetup}, or
  as global package options, via \keyword{\usepackage[options]{wordle}}.
  The order of the options does not matter, except that later options
  take precedence over earlier ones, with the exception of \option{tikz}
  and \option{tile style} keys which are always applied last.

  The \keyword{wordle} puzzles are drawn using \ctan{TikZ}, with each
  letter in the puzzle sitting inside a \ctan{TikZ} node. Many of the
  options control the settings of these nodes.

  The descriptions of the options below are grouped according to their
  function.

  Most options have both an English and a French name (for example,
  \option{rows} and \option{Lignes}, or \option{colours} and
  \option{Couleurs}). The two names are interchangeable and either can be
  used in either the \keyword{wordle} or the \keyword{GrilleSutom}
  environment, irrespective of the language of the puzzle.

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \Section{Wordle styles}

  The \option{style} key can be used to change many characteristics of
  the tiles in a \keyword{wordle} puzzle, including their colours, the
  fonts and so on.  The more common settings can be set using the
  \option{style} keyword. \textit{The style should always be set first
  because, otherwise, the style settings may override earlier settings.}

  The following styles are supported:

  \textcolor{DarkOrange}{sutom}
  \index{style!sutom}
  \index{sutom}

  \begin{example}
  \begin{wordle}[style=sutom]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  The \textcolor{DarkOrange}{sutom} style is the default
  style for the \keyword{GrilleSutom} environment.

  \textcolor{DarkOrange}{standard}
  \index{style!standard}

  \begin{example}
  \begin{wordle}[style=standard]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  The \textcolor{DarkOrange}{standard} style is the default style for the
  \keyword{wordle} environment.

  \textcolor{DarkOrange}{hard}
  \index{style!hard}

  \begin{example}
  \begin{wordle}[style=hard]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \Section{Options for the individual styles of the letter tiles}

  There are four types of letter tiles in \keyword{wordle}:
  \option{absent}, \option{present}, \option{correct} and
  \option{empty}, corresponding to letters not in the solution,
  incorrectly placed letters, correctly placed letters, and empty
  tiles, respectively. The options in this section can be used to set
  the text, tile and border colours, shapes, and frames of these tiles.

  The letter tiles in a \keyword{wordle} environment are typeset inside
  a \ctan{TikZ} \keyword{\node}. The options below control the different
  style settings of these nodes.

  \option[--]{colours}[comma separated list of valid colours]

  The \option{colours} option is a short-hand for specifying the colours
  of the \option{absent}, \option{present}, \option{correct} and
  \option{empty} tiles, in that order. Later colours can be omitted but
  the colours should be given in this order, from left to right.
  If only one colour is given then this colour is applied to all tiles.

  \begin{example}
  \begin{wordle}[colours={LightGray,Orange,Teal}]{cellar}
    pounds
    taylor
    cellar
  \end{wordle}
  \end{example}

  The colours can also be set individually using \option{absent colour},
  \option{present colour}, \option{correct colour} and \option{empty
  colour}.  To support North American dialects, it is possible to use
  \option{colors}, \option{absent color}, \option{present color},
  \option{correct color} and \option{empty color}.

  \begin{example}
  \begin{wordle}[absent colour=DarkGray,present color=Salmon,
                 correct color=SeaGreen]{cellar}
    pounds
    taylor
    cellar
  \end{wordle}
  \end{example}

  \option[white]{borders}[comma separated list of valid colours]

  Similar to the \option{colours} option, this is a short-hand for the
  setting border colour of the \option{absent}, \option{present},
  \option{correct} and \option{empty} tiles, in that order.
  If only one colour is given then this colour is applied to all tiles.

  \begin{example}
  \begin{wordle}[borders={red, orange,blue}]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  You can set the borders of the individual tiles using
  \option{absent border}, \option{present border},
  \option{correct border} and \option{empty border}

  \option[false]{frames}[comma separated list of true/false]

  This is a short-hand for adding a rectangular frame around the
  \option{absent}, \option{present}, \option{correct} and \option{empty}
  tiles, in that order, with the same background colour as the
  \option{absent} tile. This is only useful for non-square tiles.

  \begin{example}
  \begin{wordle}[frames={false,true,true}, shapes=circle]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  You can set the frames of the individual tiles using
  \option{absent frame}, \option{present frame},
  \option{correct frame} and \option{empty~frame}.

  \option[rectangle]{shapes}[comma separated list of TikZ shapes]

  Similar to the \option{colours} option, this is a short-hand for
  setting shapes of the \option{absent}, \option{present},
  \option{correct} and \option{empty} tiles, in that order.

  \begin{example}
  \begin{wordle}[shapes={circle, rectangle, circle}]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  You can set the shape shapes of the individual tiles using
  \option{absent shape}, \option{present shape},
  \option{correct shape} and \option{empty shape}
  You can use the shapes provided by the \ctan{TikZ}
  \texttt{shapes.geometric} package, including \texttt{diamond},
  \texttt{ellipse}, \texttt{trapezium} and \texttt{star}; see
  section~71.2 of the \ctan{TikZ} manual.

  \begin{example}
  % \usepackage{shapes.geometric}
  \begin{wordle}[shapes={diamond, ellipse, star}]{LADLE}
     FLAIL
     LAPEL
     *
     LADLE
     LOVER
  \end{wordle}
  \end{example}

  \option[white]{text}[comma separated list of valid colours]

  This is a short-hand for setting the text colours of the
  \option{absent}, \option{present}, \option{correct} and \option{empty}
  tiles, in that order.

  \begin{example}
  \begin{wordle}[text={red, orange,blue}]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  You can set the text borders of the individual tiles using
  \option{absent text}, \option{present border}, \option{correct
  text} and \option{empty border}


  \Section{Common tile characteristics}

  The following options apply to all tiles.

  \option[]{noalign} (default) \qquad
  \option[]{align}

  The options tweak the vertical alignment of the letters in each row of
  the puzzle. This is only likely to be useful if you have lower case
  letters in your puzzle.

  \begin{example}
  \begin{wordle}[align]{agony}
     groan
     angry
     agony
  \end{wordle}
  \end{example}

  \begin{example}
  \begin{wordle}[noalign]{agony} % the default
    groan
    angry
    agony
  \end{wordle}
  \end{example}

  \option[\textbackslash Large\textbackslash bfseries\textbackslash sffamily]{font}
       [LaTeX font specification]

  Sets the font used by all \keyword{wordle} letters. Any valid sequence
  of \LaTeX\ font commands can be used.

  \begin{example}
  \begin{wordle}[font=\large\sffamily]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  \option[1mm]{rounded}[a length]

  Set TikZ \texttt{rounded corners} key for the \keyword{wordle} letter tiles.

  \begin{example}
  \begin{wordle}[rounded=2mm]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  \option[0.5mm]{separation}[a length]

  Sets the separation distance between the \keyword{wordle} letter
  tiles.

  \begin{example}
  \begin{wordle}[separation=2mm, borders=black]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  \option[1]{scale}[a number]

  The \option{scale} option rescales the \keyword{wordle} environment.
  The \option{scale} alters the different dimensions set by the \option{rounded},
  \option{separation} \option{size} and \option{thickness}  options.  If
  you change the scale, then you will almost certainly want
  to change font size font as well, which you can do using the
  \option{font} option:

  \begin{example}
  \begin{wordle}[scale=1.5, font=\huge\bfseries]{SIZE}
     HELP
     WISE
     SIZE
  \end{wordle}
  \end{example}

  \option[8mm]{size}[a length]

  The \option{size} option sets the size of the \keyword{wordle} letter
  tiles. Unlike the \option{scale} option, \option{size} only changes
  the dimensions of the letter tiles.

  \begin{example}
  \begin{wordle}[size=10mm, font=\huge\bfseries]{LADLE}
     FLAIL LAPEL * LADLE
  \end{wordle}
  \end{example}

  \option[0.25mm]{thickness}[a length]

  Sets the border thickness of the \keyword{wordle} letter tiles.  By
  default, the borders of the tiles are white, which makes this setting
  hard to see, so the following example changes the border to red.

  \begin{example}
  \begin{wordle}[thickness=1mm, borders=red]{LADLE}
     FLAIL
     LAPEL
     LADLE
  \end{wordle}
  \end{example}

  \option[--]{tile style}[comma separated list of TikZ style keys]

  A comma-separated list of \ctan{Tikz} node keys that are appended to
  the style of the \ctan{TikZ} node that contains each of the
  \keyword{wordle} letters.  Some of the options given above can be set
  directly using the \option{tile style} option. When using the
  \option{tile style}, be careful not to break the special formatting of
  letters provided by the \keyword{wordle} environment.\par

  With most of the \keyword{wordle} options, the latter options take
  precedence, however, the \option{tile style} option is applied last,
  so it overrides any competing options.

  % TODO: Fix this because it looks like this style is being applied
  % twice because the PDF file shows a rotation of 90 = 2*45...
  \begin{example}
  \begin{wordle}[tile style={rotate=45}]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \Section{Extra rows and columns}

  By default, all of the words in a \keyword{wordle} puzzle are assumed
  to have the same number of letters as the solution, and the number of
  rows in the puzzle is the number of words given in the environment. The
  options below give more control over the number of rows and columns in
  the puzzle.

  \option[]{letters} (default)\qquad
  \option[]{noletters}

  By default, the letters in the puzzle are printed. You can hide the
  letters from the puzzle, while still keeping the \keyword{wordle} tile
  colouring, using \option{noletters}.

  \begin{example}
  \begin{wordle}[letters]{CRAZE} % the default
    TRACE
    CREAM
    CRAZE
  \end{wordle}
  \end{example}

  \begin{example}
  \begin{wordle}[noletters]{CRAZE}
    TRACE
    CREAM
    CRAZE
  \end{wordle}
  \end{example}

  \option[false]{strict}[true/false/--]

  By default, the \keyword{wordle} environment does not check that each
  word in the puzzle has the same length as the solution, so missing
  and extra letters receive no special processing.

  \begin{example}
  \begin{wordle}[strict=false]{CRAZE} % the default
    GRAIL
    CRAMPS
    CRAM
    CRABS
  \end{wordle}
  \end{example}

  The \option{strict} option enforces the word length in the puzzle by
  marking missing letters as incorrect and striking out extra letters.

  \begin{example}
  \begin{wordle}[strict]{CRAZE}
    GRAIL
    CRAMPS
    CRAM
    CRABS
  \end{wordle}
  \end{example}

  \option[--]{rows}

  By default, a \keyword{wordle} environment displays the words
  in the puzzle environment with one word per row. You can add extra
  (blank) rows to the puzzle with the \option{rows} option.

  \begin{example}
  \begin{wordle}[rows=4]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}

  The \option{rows} option only adds extra rows to the puzzle if they
  are needed. This option does not prevent ``extra'' rows from
  appearing.

  \begin{example}
  \begin{wordle}[rows=2]{ANVIL}
    CRANE
    NATAL
    ANVIL
  \end{wordle}
  \end{example}


  \option[]{*}

  You can disable the special colouring of letter tiles in a
  \keyword{wordle} puzzle by adding an asterisk,~\option{*}, as a
  \textit{word}, into the puzzle.

  \begin{example}
  \begin{wordle}{ANVIL}
    CRANE
    NATAL
    *      % disable wordle colouring
    ANNUL
    ANVIL
  \end{wordle}
  \end{example}


  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \Section{Case sensitivity}
  \index{case~sensitive}
  \index{case~sensitive!lower case}
  \index{case~sensitive!natural case}
  \index{case~sensitive!upper case}

  By default, the letters are printed in upper and lower case, exactly
  as typed, and the letter comparisons are not case sensitive.

  \option[false]{case~sensitive}

  By default the \keyword{wordle} puzzles are not case sensitive, but
  you can make them case sensitive using this option. Note that
  \keyword{case sensitive} is the same as \keyword{case sensitive=true}
  (and the default option is the same as
  \keyword{case sensitive=false}).

  \begin{example}
  \begin{wordle}[case sensitive=false]{youth} % the default
    North
    South
    Youth
  \end{wordle}
  \end{example}

  Here is a case sensitive version of this puzzle.

  \begin{example}
  \begin{wordle}[case sensitive]{youth}
    North
    South
    Youth
  \end{wordle}
  \end{example}

  As this puzzle is case sensitive, the \keyword{Y} on the last line is
  not marked as being correct because it does not match the \keyword{y}
  in the solution.

  \option[]{natural case} (default) \qquad
  \option[]{lower case} \qquad
  \option[]{upper case}

  The \option{lower case} and \option{upper case} options force all
  letters in the puzzle to be in lower or upper case, respectively.

  \begin{example}
  \begin{wordle}[lower case]{YOUTH}
    North
    South
    Youth
  \end{wordle}
  \end{example}

  \begin{example}
  \begin{wordle}[upper case]{youth}
    North
    South
    Youth
  \end{wordle}
  \end{example}

  As these examples show, both of these options disable the case
  sensitivity of the tests for colouring the \keyword{wordle} tiles;
  that is, they set \option{case sensitive=false}.  To balance the
  \option{lower case} and \option{upper case} options, the
  \option{natural case} option restores the \keyword{wordle} environment
  the default behaviour, which respects the case of the letters
  as they typed into the environment. The \option{natural case} option does
  not change the \option{case sensitive} setting.

  \begin{example}
  \begin{wordle}[natural case]{youth} % the default
    North
    South
    youth
  \end{wordle}
  \end{example}

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \Section{Adding \ctan{TikZ} code}

  The \keyword{wordle} environment is a fancy wrapper around a
  \keyword{tikzpicture} environment, with some code under the hood that
  automatically colours the letter tiles according to how well they
  match the solution. The options in this section describe how to access
  the underlying \ctan{TikZ} layer.

  \option[]{tikz}[TikZ commands]

  The \option{tikz} option passes \ctan{TikZ} keys to the underlying
  \keyword{tikzpicture} environment. The \option{tikz} option is almost
  the same as using a \keyword{\tikzset{...}} command before the
  \keyword{wordle} environment except that it is applied to the
  \keyword{tikzpicture} environment, which contains the \keyword{wordle}
  puzzle, such that the \option{tikz} keys are applied \textit{after}
  all of options above and \textit{before} \option{tile style} is
  applied.

  \begin{example}
  % \usetikzlibrary{backgrounds}
  \begin{wordle}[
      tikz={framed,
            background rectangle/.style={
              double,ultra thick, draw=SteelBlue
            }
      }]{youth}
    North South youth
  \end{wordle}
  \end{example}

  As this example indicates, it is advisable to enclose complicated
  \ctan{TikZ} settings inside braces.

  \option[W]{name}

  All of the tiles in a \keyword{wordle} puzzle are given node names of
  the form $\langle$\textsf{name}$\rangle$-$\mathsf{r}$-$\mathsf{c}$,
  for the tile in row~$\mathsf{r}$ and column~$\mathsf{c}$. By default,
  the prefix \textsf{name} is \texttt{W}. Within reason, the
  \option{name} prefix can be changed to anything you like using the
  \option{name} option.

  One way to use the named nodes for the letter tiles is with
  \ctan{TikZ} \texttt{overlay} and \texttt{remember picture} keys:

  \begin{example}
  \begin{wordle}[tikz={remember picture}]{CRAZE}
    TRACE
    CREAM
    CRAZE
  \end{wordle}
  \end{example}

  This makes it possible, for example, to draw arrows to tiles in a
  \keyword{wordle} puzzle:

  \begin{example}
  \tikz[remember picture]\draw[overlay, very thick, opacity=0.5,->,red](0,0)node{No M!} to [out=90, in=180](W-2-5);
  \end{example}

  A second use of the tile node names is in conjunction with \ctan{TikZ}
  commands that can be added to a \keyword{wordle} puzzle using the
  second optional argument to the environment. As with the \option{tikz}
  option, it is advisable to enclose complicated \ctan{TikZ} commands
  inside braces.

  \begin{example}
  \begin{wordle}[name=M,
        tikz={arr/.style={Red,ultra thick,->}}
      ]{MACAW}
      [{
        \draw[arr](M-1-3.south)--(M-3-2.north)--(M-4-2.north);
        \draw[arr](M-1-1.south)--(M-3-5)--(M-4-3.north east);
      }]
    CRANE HOTLY BASIC MACAW
  \end{wordle}
  \end{example}

  In practice, we are not convinced that anyone will find a real use for this!

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \Section{The package code}

  The \keyword{wordle} package is a \LaTeX3 package. There are many
  comments in the code explaining how the code works. The automatic
  colouring of the letter tiles is a fun exercise in \LaTeX3
  programming, which was motivated by a
  \href{https://tex.stackexchange.com/questions/659860/wordle-like-colored-letter-boxes-in-latex/660056#660056}{tex.stackexchange.com} post.

  Bug reports and feature requests can be made on \href{https://github.com/AndrewMathas/Wordle}{github}.

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \printindex

\end{document}
