1

Question:

How can I modify the following code so that it takes 2 more arguments (background color, and font color)?

MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{ \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}

\begin{document}

\circled{+}

\end{document}

Current Output:

enter image description here

Ideal Output:

\circled{+}{#00d131}{#ffffff} would yield:

enter image description here

FWIW:

I'm open to other suggestions if the above MWE is not the optimum method for such tasks.

3kstc
  • 931
  • 6
  • 22

1 Answers1

3

Try this, and more details please read this link and this for how to define a command with and without optional arguments.

\newcommand*\circled[3]{
    \definecolor{fill_color}{HTML}{#2}
    \tikz[baseline=(char.base)]{
        \node[shape=circle, fill=fill_color, draw,inner sep=2pt] (char) {\textcolor[HTML]{#3}{#1}};}}

\circled{+}{00d131}{ffff3f}

Ukiyo-E
  • 728