We recommend the listings package (pdf) which can be used for code boxes, and in which you can set custom colors, e.g. see this beamer example on tex.stackexchange.

[edit] Overleaf guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files