[Tex/LaTex] Circled text with tikz Black background and white text

backgroundscolortikz-pgf

Given this simple scenario:

\documentclass{article}
\usepackage{tikz}
\newcommand\encircle[1]{%
\tikz[baseline=(X.base)] 
   \node (X) [draw, shape=circle, inner sep=0] {\strut #1};}
\begin{document}
\section{Introduction}
\encircle{A}
\end{document}

The output is this:
enter image description here

How do I change it so that the circle has a black background and the color of the text inside the circle is white (basically, reversing the colors) ?

Best Answer

Use the fill key to set the background colour and the text key to set the text colour; in your application this means fill=black, text=white.

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\newcommand\encircle[1]{%
  \tikz[baseline=(X.base)] 
    \node (X) [draw, shape=circle, inner sep=0, fill=black, text=white] {\strut #1};%
}
\begin{document}
\encircle{A}
\end{document}

enter image description here