Search code examples
latexfont-awesomergbpdflatexoverleaf

Can I change the colour of a FontAwesome logo (i.e. twitter/ORCiD/phone) using a RGB or HEX Code?


I'm using the CurVe CV template in Overleaf.

I've changed the colour scheme to purple (from default of green).

In the header, I want to include my email, twitter, phone and ORCiD details, using Font Awesome.

All those logos have been changed to purple, but I want to be able to choose the colour of each logo independently, using HEX or RGB codes, rather than words like green or blue

\documentclass[a4paper,11pt,english]{curve}

\usepackage{settings}
  \usepackage{fontspec} 
  \usepackage[p,osf,swashQ]{cochineal}
  \usepackage[medium,bold]{cabin}
  \usepackage[varqu,varl,scale=0.9]{zi4}
\else % If you're using pdfLaTeX or latex
  \usepackage[T1]{fontenc}
  \usepackage[p,osf,swashQ]{cochineal}
  \usepackage{cabin}
  \usepackage[varqu,varl,scale=0.9]{zi4}
\fi

\myname{xxx}{xxx}

\definecolor{SwishLineColour}{HTML}{000080}
\definecolor{MarkerColour}{HTML}{000080}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\leftheader{%
  {\LARGE\bfseries\sffamily xxx
  \vspace{5} \\
  xxxxxx}\\
  
  %
  \makefield{\faEnvelope[regular]}{\texttt{[email protected]}}
  \makefield{\color{blue}\faTwitter}{\texttt{@xxx}}
  \makefield{\faPhone}{\texttt{{+xx}xxxx}}\\
  \makefield{\color{green}\faOrcid}{0000-0000-0000-0000}\\
  %

The code I want to change is this last section to allow me to define the colour of each logo by HEX or RGB rather than the "green" or "blue":

\makefield{\color{HEX or RGB}\faTwitter}{\texttt{@xxx}}


Solution

  • You can define your own colours in hex, rgb etc.

    \definecolor{mycolour}{HTML}{0BA080}    
    \definecolor{mygreen}{rgb}{0,0.8,0}
    

    and then use these colours for your icons.

    Some other comments:

    • you mustn't use \else ... \fi without an if statement before it

    • your \leftheader{ lacks a closing }


    % !TeX TS-program = lualatex
    
    \documentclass[a4paper,11pt,english]{curve}
    
      \usepackage{settings}
      \usepackage{fontspec} 
      \usepackage[p,osf,swashQ]{cochineal}
      \usepackage[medium,bold]{cabin}
      \usepackage[varqu,varl,scale=0.9]{zi4}
    %\else % If you're using pdfLaTeX or latex
    %  \usepackage[T1]{fontenc}
    %  \usepackage[p,osf,swashQ]{cochineal}
    %  \usepackage{cabin}
    %  \usepackage[varqu,varl,scale=0.9]{zi4}
    %\fi
    
    \myname{xxx}{xxx}
    
    \definecolor{SwishLineColour}{HTML}{000080}
    \definecolor{MarkerColour}{HTML}{000080}
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
    \definecolor{mygreen}{rgb}{0,0.8,0}
    
    
    \leftheader{%
      {\LARGE\bfseries\sffamily xxx
      \vspace{5pt} \\
      xxxxxx}\\
      
      %
      \makefield{\faEnvelope[regular]}{\texttt{[email protected]}}
      \makefield{\color{blue}\faTwitter}{\texttt{@xxx}}
      \makefield{\faPhone}{\texttt{{+xx}xxxx}}\\
      \makefield{\color{mygreen}\faOrcid}{0000-0000-0000-0000}\\
      %
    }
    
    
    
    \rightheader{~}
    
    
    \title{Curriculum Vitae}
    
    \begin{document}
    \makeheaders[c]
    
    \makerubric{employment}
    \makerubric{education}
    
    test
    
    \end{document}
    

    enter image description here