Let's get fancy: Text like tag?
Here's an alternative solution with Tikz.
Output
Code
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\definecolor{backg}{RGB}{225,236,244}
\definecolor{tagtxt}{RGB}{88,115,159}
\newcommand\sotag[1]{%
\tikz[baseline]{%
\node[anchor=base, text=tagtxt, fill=backg, font=\sffamily, text depth=.5mm] {#1};
}%
}
\begin{document}
Here are some tags: \sotag{android}, \sotag{broadcastreceiver}, and \sotag{gallery}
\end{document}
\documentclass{article}
\usepackage[skins]{tcolorbox}
\newtcolorbox{tagbox}[1][]{colback=blue!20!white,sharp corners,boxrule=0pt,enhanced jigsaw,nobeforeafter,width=3cm,halign=center,valign=center}
\newcommand{\sotagbox}[1]{%
\begin{tagbox}
#1
\end{tagbox}
}
\begin{document}
\sotagbox{foo}
\end{document}
Update: With a tikz style and replacing sharp corners
by arc=0pt
etc.
\documentclass{article}
\usepackage[skins]{tcolorbox}
\newtcolorbox{tagbox}[1][]{
colback=blue!20!white,
arc=0pt,
auto outer arc,
% sharp corners,
boxrule=0pt,
enhanced jigsaw,
nobeforeafter,
width=2cm,
boxsep=0pt,
halign=center,
valign=center,
box align=center,
colupper={blue!40!black}, % a dark blue
fontupper={\bfseries},
top=\fboxsep,
bottom=\fboxsep,
left=\fboxsep,
right=\fboxsep,
baseline=\fboxsep,
#1
}
\newcommand{\sotagbox}[2][]{%
\begin{tagbox}[#1]%
#2
\end{tagbox}%
}
\begin{document}
\sotagbox{foo} versus \colorbox{blue!20!white}{foo} and something with a shadow: \sotagbox[drop shadow]{foo}
\end{document}
You could use \colorbox{red}{text}
from the standard latex color
package.