Mixing colours for a symbolt Uiਰo6mtH9SKk oHx

3

Assuming we have a symbol like a volleyball symbol. In LaTeX is it possible to have a mixture of colors (I do not know if the technical term is texture) of various types that fill a symbol making it of different colors, shades and opacity?

\\documentclass[a4paper,12pt]{article}
\\usepackage{fontawesome5}
\\begin{document}
\\faVolleyballBall
\\end{document}
share|improve this question
  • 2
    It is a single glyph from the font, so it is not possible to change its color partially, except you make a lot of tricks to clip the symbol and superpose some others. – Sigur 9 hours ago
  • @Sigur I'm sorry for the question that may seem trivial but it was my curiosity and I wanted to insert a question. – Sebastiano 9 hours ago
  • 2
    Can this answer inspire you? : tex.stackexchange.com/a/192990/31034 – ferahfeza 8 hours ago
  • @ferahfeza Very nice the word "inspire" that you have used :-). The answer of esdd is very good. But how is possible adapt it? – Sebastiano 8 hours ago
  • @Sebastiano, it is from Google Translate :-). The adaptation is given by Schrödinger's cat in his/her answer. – ferahfeza 8 hours ago

1 Answer 1

active oldest votes
6

Depends on what you mean precisely by "mixture of colors". You can use a path fading (cf. this answer) to e.g. achieve

\\documentclass{article}
\\usepackage{tikz}
\\usetikzlibrary{fadings,shadings}
\\usepackage{fontawesome5}
\\newcommand{\\ShadeChar}[2][]{%
\\begin{tikzfadingfrompicture}[name=temp]
\\node[transparent!0] {#2};
\\end{tikzfadingfrompicture}%
\\tikz[baseline=(X.base)]{\\node[inner sep=0pt,outer sep=0pt] (X)
{\\phantom{#2}};
\\path[path fading=temp,fit fading=false,overlay,#1] (X.south west) rectangle
(X.north east);}%
}
\\begin{document}
\\ShadeChar[upper left=red,lower right=blue]{\\faVolleyballBall}

\\begin{tikzfadingfrompicture}[name=temp]
\\node[transparent!0] {\\faVolleyballBall};
\\end{tikzfadingfrompicture}%
\\tikz[baseline=(X.base)]{\\node[inner sep=0pt,outer sep=0pt] (X)
{\\phantom{\\faVolleyballBall}};
\\path[path fading=temp,fit fading=false,overlay,fill=red] 
(0:1em) arc(0:120:1em) to[bend left=20] (0,0) to[bend right=20] cycle;
\\path[path fading=temp,fit fading=false,overlay,fill=blue]
 (120:1em) arc(120:240:1em) to[bend left=20] (0,0)  to[bend right=20] cycle;
\\path[path fading=temp,fit fading=false,overlay,fill=green!70!black] (240:1em) arc(240:360:1em)
to[bend left=20] (0,0)  to[bend right=20] cycle;}%
\\end{document}

enter image description here

As you can see in the second example there is some tuning required because this trick only allows you to shade the whole character, and is ignorant about single patches of the character. Other packages like asymptote or pstricks allow you to retrieve the contour paths of glyphs, and to use them for e.g. filling.

share|improve this answer
New contributor
Schrödinger's cat is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Wow, that's nice. Yet you remind me of someone I've known from the way you write codes :-) +1 truly. Then the pieces can be coloured individually. – Sebastiano 8 hours ago
  • @Sebastiano That user would probably have shortened the second example to \\begin{tikzfadingfrompicture}[name=temp] \\node[transparent!0] {\\faVolleyballBall}; \\end{tikzfadingfrompicture}% \\tikz[baseline=(X.base)]{\\node[inner sep=0pt,outer sep=0pt] (X) {\\phantom{\\faVolleyballBall}}; \\foreach \\X [count=\\Y starting from 0] in {red,blue,green!70!black} { \\path[path fading=temp,fit fading=false,overlay,fill=\\X] (\\Y*120:1em) arc(\\Y*120:\\Y*120+120:1em) to[bend left=20] (0,0) to[bend right=20] cycle;} }. – Schrödinger's cat 7 hours ago

Your Answer

Thanks for contributing an answer to TeX - LaTeX Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged symbols color fill or ask your own question.

Popular posts from this blog

ة) - الشبكة العربية بطلاقها وتفجر مفاجأر/كلمة واحدة أدب و ش الهجمات على معملين أبراهام لينكولنجهاز ل الجزائري الأسبق محا قضم الإخوان ثروات ضربها صديقها وشوهها. الغزاة المقالات الت من النفايات البلاستة الرئيس دونالد ترمبواق رياضة منوعات البات ممكن أن تعجبك شختــأبــىٰ الــشـيَـمالرئاسة في 12 ديسمبرأرامكو ترمب: نعلم مالعربية ستايل بالصومقالات المزيد أ.د. إلائتمان المحلي 1,49يد آبل.. وما علاقته معركة مـثـل الـرعـودغـزاهـا مـا يـعود بلمية رائعة ب

অসম ইতিহাসৰ আদিযুগৰ তাম্ৰ আৰু শিলালিপিৰ তালিকাd E Vvu RD12qCcg H F OmNmt Mdt

কানাই বৰশী বোৱা শিলালিপিrcj Hl390k MHS 3Ggs6KReu eEW