Skip to content

Instantly share code, notes, and snippets.

@jnothman
Last active November 17, 2021 05:08
Show Gist options
  • Save jnothman/0729018fc39b2c30f082 to your computer and use it in GitHub Desktop.
Save jnothman/0729018fc39b2c30f082 to your computer and use it in GitHub Desktop.
"Fork me on GitHub" ribbon in LaTeX/TikZ vector graphic
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="303.63" width="303.63" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs>
<mask id="mask3843">
<g clip-path="url(#clipPath3831)">
<g clip-path="url(#clipPath3835)">
<g transform="translate(253.05 18.929)">
<path stroke-linejoin="round" d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z" stroke="#080808" stroke-miterlimit="10" stroke-width="7.9701" fill="none"/>
<path stroke-linejoin="round" d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z" stroke="#181818" stroke-miterlimit="10" stroke-width="5.6929" fill="none"/>
<path stroke-linejoin="round" d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z" stroke="#282828" stroke-miterlimit="10" stroke-width="3.4158" fill="none"/>
<g clip-path="url(#clipPath3839)">
<path fill="#808080" d="m-253.05-18.929h506.11v37.858h-506.11v-37.858z"/>
<path stroke-linejoin="round" d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z" stroke="#787878" stroke-miterlimit="10" stroke-width="7.9701" fill="none"/>
<path stroke-linejoin="round" d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z" stroke="#686868" stroke-miterlimit="10" stroke-width="5.6929" fill="none"/>
<path stroke-linejoin="round" d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z" stroke="#585858" stroke-miterlimit="10" stroke-width="3.4158" fill="none"/>
</g>
<path stroke-linejoin="round" d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z" stroke="#404040" stroke-miterlimit="10" stroke-width="1.1386" fill="none"/>
</g>
</g>
</g>
</mask>
<clipPath id="clipPath3839">
<path d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z"/>
</clipPath>
<clipPath id="clipPath3835">
<path d="m0 0h506.1v37.858h-506.1v-37.858z"/>
</clipPath>
<clipPath id="clipPath3831">
<path d="m0 0h506.1v37.858h-506.1v-37.858z"/>
</clipPath>
</defs>
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g transform="translate(-17.006 -20.231)">
<g transform="matrix(1.25 0 0 -1.25 160.46 146.25)">
<g transform="matrix(.7071 .7071 -.7071 .7071 -64.176 50.229)">
<g transform="translate(-253.05 -18.929)">
<g mask="url(#mask3843)">
<g transform="translate(253.05 18.929)"><!-- drop shadow -->
<path d="m-253.05-18.929h506.11v37.858h-506.11v-37.858z"/>
</g>
</g>
</g>
<!-- background -->
<path fill="#c00" d="m-249.07-14.944h498.14v29.888h-498.14v-29.888z"/>
<g transform="translate(-84.536 -707.46)">
<text transform="matrix(1 0 0 -1 39.7 703.86)">
<tspan font-weight="bold" font-size="9.9626px" y="0" x="0 6.0871487 12.174297 16.049749 24.358557 33.215309 41.524117 47.611267 56.468018 64.218918 66.988525 70.306068 77.499069 83.586212" font-family="Helvetica" fill="#eeeeee">ForkmeonGitHub</tspan>
</text>
</g>
<path d="m-249.07 11.955v-23.911h498.14v23.911h-498.14z" stroke="#f5f5f5" stroke-miterlimit="10" stroke-dasharray="4.98138, 1.19556" stroke-width=".79703" fill="none"/>
</g>
</g>
</g>
</svg>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
\documentclass{article}
\usepackage{tikz}
\usepackage{ifthen}
\usepackage{xcolor}
\usetikzlibrary{shadows.blur}
\newlength{\forkmeoffset}
\setlength{\forkmeoffset}{12em}
\definecolor{forkmebg}{HTML}{CC0000}
\definecolor{forkmefg}{HTML}{EEEEEE}
\newcommand{\forkme}[1][west]{
\ifthenelse{\equal{#1}{east}}{%
\tikzset{forkmerot/.style={rotate=-45}}
}{%
\tikzset{forkmerot/.style={rotate=45}}
}
\begin{tikzpicture}[remember picture, overlay]
\node[forkmerot, shift={(0, -\forkmeoffset)}] at (current page.north #1) {
\begin{tikzpicture}[remember picture, overlay]
\node[fill=forkmebg, text centered, minimum width=50em, minimum height=3.0em, blur shadow, shadow yshift=0pt, shadow xshift=0pt, shadow blur radius=.4em, shadow opacity=50, text=forkmefg](fmogh) at (0pt, 0pt) { \fontfamily{phv}\selectfont\bfseries Fork me on GitHub};
\draw[forkmefg!60, dashed, line width=.08em, dash pattern=on .5em off 1.5\pgflinewidth] (-25em,1.2em) rectangle (25em,-1.2em);
\end{tikzpicture}
};
\end{tikzpicture}
}
\begin{document}
\forkme[west]
{\LARGE\colorlet{forkmebg}{blue} \setlength{\forkmeoffset}{8cm} \forkme[east]}
Variables include:
\begin{itemize}
\item \texttt{{\textbackslash}forkme[west]} vs \texttt{{\textbackslash}forkme[east]}
\item shift offset (length: \texttt{{\textbackslash}forkmeoffset})
\item node fill color (color: \texttt{forkmebg})
\item text and line color (color: \texttt{forkmefg})
\item text size: inherited from surrounding context
\end{itemize}
\end{document}
@faustomilletari
Copy link

It is possible to add the link changing
\node[fill=forkmebg, text centered, minimum width=50em, minimum height=3.0em, blur shadow, shadow yshift=0pt, shadow xshift=0pt, shadow blur radius=.4em, shadow opacity=50, text=forkmefg](fmogh) at (0pt, 0pt) { \fontfamily{phv}\selectfont\bfseries Fork me on GitHub};

to

\node[fill=forkmebg, text centered, minimum width=50em, minimum height=3.0em, blur shadow, shadow yshift=0pt, shadow xshift=0pt, shadow blur radius=.4em, shadow opacity=50, text=forkmefg](fmogh) at (0pt, 0pt) { \fontfamily{phv}\selectfont\bfseries \href{https://url.com}{Fork me on GitHub} };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment