TransWikia.com

Paint JavaScript functions in keywords

TeX - LaTeX Asked by justcasper on March 21, 2021

lstdefinelanguage{JavaScript}{ 
    alsoletter={(,)},
    keywords={typeof, new, for,  catch, function, return, null, catch, switch, let , let, var, if, in, while, do, else, case, const, break},
    keywords=[3]{querySelector,addEventListener,Date,log,createElement,appendChild,beginPath,arc,random,degToRad,addEventListener,addEventListener,alert,function expensiveOperation},
    keywords=[4]{true,false},
    stringstyle=color{JSgreen},
    ndkeywords={class, export, boolean, throw, implements, import, this},
    ndkeywordstyle=color{red}bfseries,
    keywordstyle=color{JSblue},
    keywordstyle=[3]color{JSpink},
    keywordstyle=[4]color{JSpruple},
    morecomment=[s]{/*}{*/},
    morecomment=[l]//,
    morestring=[b]",
    morestring=[b]',
    literate=*{0}{{textcolor{JSpruple}{0}}}{1}%
    {1}{{textcolor{JSpruple}{1}}}{1}%
    {2}{{textcolor{JSpruple}{2}}}{1}%
    {3}{{textcolor{JSpruple}{3}}}{1}%
    {4}{{textcolor{JSpruple}{4}}}{1}%
    {5}{{textcolor{JSpruple}{5}}}{1}%
    {6}{{textcolor{JSpruple}{6}}}{1}%
    {7}{{textcolor{JSpruple}{7}}}{1}%
    {8}{{textcolor{JSpruple}{8}}}{1}%
    {9}{{textcolor{JSpruple}{9}}}{1}%
    {.0}{{textcolor{JSpruple}{.0}}}{1}% Following is to ensure that only periods
    {.1}{{textcolor{JSpruple}{.1}}}{1}% followed by a digit are changed.
    {.2}{{textcolor{JSpruple}{.2}}}{1}%
    {.3}{{textcolor{JSpruple}{.3}}}{1}%
    {.4}{{textcolor{JSpruple}{.4}}}{1}%
    {.5}{{textcolor{JSpruple}{.5}}}{1}%
    {.6}{{textcolor{JSpruple}{.6}}}{1}%
    {.7}{{textcolor{JSpruple}{.7}}}{1}%
    {.8}{{textcolor{JSpruple}{.8}}}{1}%
    {.9}{{textcolor{JSpruple}{.9}}}{1}%
    {=}{{textcolor{JSbrown}{=}}}{1}%
    {>}{{textcolor{JSbrown}{>}}}{1}%
    {<}{{textcolor{JSbrown}{<}}}{1}%
    {+}{{textcolor{JSbrown}{+}}}{1}%´
    { }{{ }}{1}% handle the space
    {{}{{textcolor{JSgrey}{{}}}{1}
    {}}{{textcolor{JSgrey}{}}}}{1}
    {[}{{textcolor{JSgrey}{[}}}{1}
    {]}{{textcolor{JSgrey}{]}}}{1}
    {(}{{textcolor{JSgrey}{(}}}{1}
    {)}{{textcolor{JSgrey}{)}}}{1}
    {;}{{textcolor{JSgrey}{;}}}{1}
    {,}{{textcolor{JSgrey}{,}}}{1}
    ,
}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP