I am trying to make a Latex command which allows me to deploy some kind of progress bars. Ideally something like this is the goal:
As a side note, I'll probably replace this progress bar later with arrows or something. Anyway, here is the relevent code thus far
https://www.overleaf.com/read/nmmdhbrncrhh
\documentclass{article}
\RequirePackage{tikz}
\usetikzlibrary{arrows, backgrounds}
\definecolor{cvblue}{HTML}{0E5484}
\colorlet{maincolor}{cvblue}
\colorlet{skillbg}{black!25}
\colorlet{iconcolor}{maincolor!90}
\newlength\sidebarwidth%
\newlength\topbottommargin%
\newlength\leftrightmargin%
\newlength\sidebartextwidth
\setlength{\sidebarwidth}{0.34\paperwidth}
\setlength{\topbottommargin}{0.02\paperheight}
\setlength{\leftrightmargin}{0.02\paperwidth}
\setlength{\sidebartextwidth}{\sidebarwidth - 2\leftrightmargin}
\newcommand{\logo}[1]{\includegraphics[align=c, width=1.5em]{#1}}
\newcommand{\barskilltwo}[4]{
% remove 1pt in width to prevent overfull box warnings
\begin{tikzpicture}[x=\sidebartextwidth-1pt, y=2ex]
\draw[fill, skillbg, rounded corners=0.5em]
(0, 0) rectangle (1, 1) node[midway][text=black] {#4};
\draw[fill, iconcolor!70, rounded corners=0.5em]
(0, 0) rectangle (#3/100, 1);
\node[above right] at (0, 1) {\cvicon{#1} ~ #2};
\end{tikzpicture}
\par
}
\begin{document}
\barskilltwo{\logo{pics/tech_languages/c++.png}}{C++}{100}{Six Years}
\barskilltwo{\logo{pics/tech_languages/python.png}}{Python}{100}{Six Years}
\barskilltwo{\logo{pics/tech_languages/c.png}}{C}{45}{Three Years}
\barskilltwo{\logo{pics/tech_languages/java.png}}{Java}{20}{Two Years}
\barskilltwo{\logo{pics/tech_languages/csharp_purple.png}}{C\#}{10}{One Year}
\end{document}
And here is the effect:
As you can see, there is a problem in that the text is hidden by the second blue bar.
My goal is to have text which is on top of all other elements, but is aligned relative to the midpoint of bottom element via node[midway]
Is such a thing possible? What is the best way to achieve the effect described in the first screenshot?
I have also tried to create a new node like so:
\newcommand{\barskilltwo}[4]{
% remove 1pt in width to prevent overfull box warnings
\begin{tikzpicture}[x=\sidebartextwidth-1pt, y=2ex]
\draw[fill, skillbg, rounded corners=0.5em]
(0, 0) rectangle (1, 1);
\draw[fill, iconcolor!70, rounded corners=0.5em]
(0, 0) rectangle (#3/100, 1);
\node[above right] at (0, 1) {\cvicon{#1} ~ #2};
\node[midway][text=black] {#4};
\end{tikzpicture}
\par
}
But this would need manual alignment and is not guaranteed to be aligned with the midpoint of the bottom element.
This can be solved with an extra node at the bottom:
\node(text) at (0.5,0.5){#4};
But I suspect I might run into alignment issues later on if I wanted to resize the bar for example. Is there a way to get this perfectly relative to the bottom node width midpoint?
Any help would be much appreciated. Thank you for reading.