4

does someone already make a such kind of packages like github readme:

​Build Status​​Quality Gate Status​

if no,how to make a such kind of badges in tcolorbox!

1 Answer 1

6

Here is something for you to get start with:

\documentclass{article}

\usepackage{fontawesome5}
\usepackage[many]{tcolorbox}

\NewDocumentCommand \GitHubBadge { m m m }
  {
    \tcbsidebyside
      [
        enhanced, sidebyside, sidebyside adapt=both,
        bicolor, colback=black, colbacklower=green!70!black,
        frame hidden,
        left=2pt, right=2pt, top=0pt, bottom=0pt,
        sidebyside gap=1em,
      ]
    {\sffamily\textcolor{gray}{#1}~\textcolor{white}{#2}\hspace{-.5em}\phantom{q}}
    {\sffamily\hspace{-1.5em}\phantom{#1}\textcolor{white}{#3}\hspace{-.5em}\phantom{q}}
  }

\begin{document}

\GitHubBadge { \faIcon{github} } { Build } { passing }

\end{document}

The \phantoms are for the vertical alignment of the text on two sides.

enter image description here


Below is a version with text shadow:

\documentclass{article}

\usepackage{fontawesome5}
\usepackage[many]{tcolorbox}
\usepackage{shadowtext}

\NewDocumentCommand \GitHubBadge { m m m }
  {
    \shadowoffsetx{0pt}
    \shadowoffsety{0.6pt}
    \tcbsidebyside
      [
        enhanced, sidebyside, sidebyside adapt=both,
        bicolor, colback=black, colbacklower=green!70!black,
        frame hidden,
        left=2pt, right=2pt, top=0pt, bottom=0pt, boxsep=1.5pt,
        sidebyside gap=0em,
      ]
    {\shadowcolor{black!80}\sffamily\textcolor{gray}{#1}\!\textcolor{white}{\shadowtext{#2}}\hspace{-.5em}\phantom{q}}
    {\shadowcolor{black!60}\sffamily\hspace{-1.5em}\phantom{#1}\textcolor{white}{\shadowtext{#3}}\hspace{-1em}\phantom{q}}
  }

\begin{document}

\GitHubBadge { \faIcon{github} } { Build } { passing }

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .