[Tex/LaTex] Graphics to represent a loading bar for language skills in a CV – Fraction values

cvgraphics

I'am really new to LaTeX and I was using one of the templates provided to create my CV with class altacv. To represent my language skills you are provided with \cvskill defined as follows:

\newcommand{\cvskill}[2]{%
  \textcolor{emphasis}{\textbf{#1}}\hfill 
  \foreach \x in {1,...,5}{%
    \space{\ifnumgreater{\x}{#2}{\color{body!30}}{\color{accent}}\ratingmarker}}\par% 
}

And the result is the following:

enter image description here

I would like to add my english level with a value of 4.5 so that the last circle is half filled. I have found this but I haven't been able to succesfully implement it in my template. Basically what I want is that when I input:

\cvskill{English}{4.5}

I obtain the following:

enter image description here

Thanks in advance 🙂

Best Answer

Well you can merge the command \cvskill and the used command \grade in your linked question for a possibly solution.

Based on both you can add the following code into your preamble:

% <============================================================ new code 
\renewcommand{\cvskill}[2]{%
  \textcolor{emphasis}{\textbf{#1}}\hfill
  \grade{#2}
}
\definecolor{frontColor}{rgb}{0.22,0.45,0.70}% light blue
\definecolor{backColor}{RGB}{200,200,200}% grey
\newcommand{\grade}[1]{%
    \begin{tikzpicture}
    \clip (1em-.4em,-.35em) rectangle (5em +.5em ,1em);
    \foreach \x in {1,2,...,5}{
        \path[{fill=backColor}] (\x em,0) circle (.35em);
    }
    \begin{scope}
    \clip (1em-.4em,-.35em) rectangle (#1em +.5em ,1em);
    \foreach \x in {1,2,...,5}{
        \path[{fill=frontColor}] (\x em,0) circle (.35em);
    }
    \end{scope}

    \end{tikzpicture}%
}

With the following complete code (MWE)

\documentclass[10pt,a4paper]{altacv}

%Layout
\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm,footskip=2\baselineskip}

%Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[default]{lato}
\usepackage{CJKutf8}
\usepackage{hyperref}

%Colors

\definecolor{accent}{HTML}{000e17}
\definecolor{heading}{HTML}{000e17}
\definecolor{emphasis}{HTML}{696969}
\definecolor{body}{HTML}{01415f}

\colorlet{heading}{heading}
\colorlet{accent}{accent}
\colorlet{emphasis}{emphasis}
\colorlet{body}{body}

\renewcommand{\itemmarker}{{\small\textbullet}}
\renewcommand{\ratingmarker}{\faCircle}

% <============================================================ new code 
\renewcommand{\cvskill}[2]{%
  \textcolor{emphasis}{\textbf{#1}}\hfill
  \grade{#2}
}
\definecolor{frontColor}{rgb}{0.22,0.45,0.70}% light blue
\definecolor{backColor}{RGB}{200,200,200}% grey
\newcommand{\grade}[1]{%
    \begin{tikzpicture}
    \clip (1em-.4em,-.35em) rectangle (5em +.5em ,1em);
    \foreach \x in {1,2,...,5}{
        \path[{fill=backColor}] (\x em,0) circle (.35em);
    }
    \begin{scope}
    \clip (1em-.4em,-.35em) rectangle (#1em +.5em ,1em);
    \foreach \x in {1,2,...,5}{
        \path[{fill=frontColor}] (\x em,0) circle (.35em);
    }
    \end{scope}

    \end{tikzpicture}%
}


\begin{document}

\cvsection[%
% page1sidebar % <================================== not needed for demo
]{Experience}

\cvevent{COO - Chief Operating Officer}{Evoleo Technologies, Lda}{April 2016 -- Ongoing}{Porto, Portugal}

\begin{itemize}
    \item Operational management in the areas of development, production and logistics;
\end{itemize}

\divider
%
\cvsection{Languages}

\cvskill{English}{5}
\divider

\cvskill{Spanish}{4.5} % <==============================================
\divider

\cvskill{German}{3}

\end{document}

you get the result:

result

Please next time add the MWE to your question, do not use a link!