Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

colours for syntax highlighting

by morgon (Priest)
on Nov 19, 2019 at 20:41 UTC ( #11108906=perlquestion: print w/replies, xml ) Need Help??

morgon has asked for the wisdom of the Perl Monks concerning the following question:


I am currently tweaking the way my vim does syntax-highlighting and would be curious as to what colours people use for their syntax-highlighting...

So what colours do you use (or resign yourself to live with) for the various syntactic categories (comment, identifier, constant etc)?

Can you give a reason as to why you chose this particular colour-combination (apart from liking it)?

Many thanks!

Replies are listed 'Best First'.
Re: colours for syntax highlighting
by Tux (Abbot) on Nov 20, 2019 at 10:50 UTC

    I think I have a non-standard coloring scheme. This shows a small piece of perl code. As for choroba it developed over time, and was chosen to be a compromise between easy to read and standing out. I like grayish backgrounds. Another reason is it fits well in my simple design for presentations I have used over the years.

    FWIW, as I (still) use "elvis" (instead of vim, as (g)vim is very hard to get compiled on HP-UX and AIX with a working GUI), I do not use a named color scheme as g/vim offers.

    Enjoy, Have FUN! H.Merijn
Re: colours for syntax highlighting
by Fletch (Chancellor) on Nov 19, 2019 at 21:24 UTC

    Currently using Nord for most everything (emacs, iTerm). Comments are muted, identifiers stand out, keywords are different but don't. Before that it was zenburn which has similar "low contrast" colors.

    I like dark backgrounds and those two work well without being angry fruit salad (e.g. dark background solarized feels slightly LOUD).

    Update: Actually I do use the monokai (c.f. emacs version) for bat (a colourizing cat(1) drop in) which is marginally irate fruit salad.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: colours for syntax highlighting
by choroba (Archbishop) on Nov 20, 2019 at 08:10 UTC
    This is how it looks on my work laptop. At home, the colours are a bit different to keep my brain in attention. It evolved over the years from the default configuration.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re: colours for syntax highlighting
by tobyink (Canon) on Nov 19, 2019 at 23:44 UTC

    I mostly use SciTE for editing and use its default colours. A lot of thought seems to have been put into them, and they work pretty well. Comments are green; keywords are blue and bold; certain operators and other punctuation are black and bold. Scalar identifiers have a pink/red background; array identifiers have yellow backgrounds (and so does qw(...)); hash identifiers have purple backgrounds; regexps have green backgrounds. String constants are kind of purple; numeric constants are kind of aqua. That's about it, I think.

Re: colours for syntax highlighting
by jcb (Vicar) on Nov 20, 2019 at 00:11 UTC

    I generally use Emacs' CPerl mode and its default syntax highlighting colors on a light background. I have found that having a consistent set is more valuable than any particular aesthetics, but your mileage may vary.

      After activating a theme via M-x load-theme you'll get a "consistent set" of colours.

      I'm using zenburn - a port from vim - but there are many more available.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        By "consistent" I meant more that the colors do not change. In other words, picking a color scheme and staying with it, and I have been using Emacs for much longer than I have known that it had this feature... but maybe it is time to try a change...


Re: colours for syntax highlighting
by stevieb (Canon) on Nov 20, 2019 at 14:31 UTC

    I use the default colours, but I enable subroutine folding:

    " allow folding of Perl subs "let perl_fold = 1 function GetPerlFold() if getline(v:lnum) =~ '^\s*sub\s' return ">1" elseif getline(v:lnum) =~ '\}\s*$' let my_perlnum = v:lnum let my_perlmax = line("$") while (1) let my_perlnum = my_perlnum + 1 if my_perlnum > my_perlmax return "<1" endif let my_perldata = getline(my_perlnum) if my_perldata =~ '^\s*\(\#.*\)\?$' " do nothing elseif my_perldata =~ '^\s*sub\s' return "<1" else return "=" endif endwhile else return "=" endif endfunction setlocal foldexpr=GetPerlFold() setlocal foldmethod=expr

    Here's an example of what it looks like. Use zo to open a fold, and zc to close it back up.

Re: colours for syntax highlighting
by afoken (Canon) on Nov 21, 2019 at 11:50 UTC

    I don't care much about the color scheme. During my daily work, I switch between at least four editors (AtmelStudio, Notepad++, joe in a PuTTY or xterm window, Qt Creator). All of them have usable defaults, except for PuTTYs dark blue on black, which is a little bit too dark and has to be changed. All editors highlight keywords, strings, comments, and some other things, and that's good enough for me. I work with different languages (C, C++, Perl, Bash, Batches, XML, HTML, Markdown, and others), with different highlighting, and so things never look the same anyway.


    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: colours for syntax highlighting
by jdporter (Canon) on Nov 19, 2019 at 21:57 UTC


Re: colours for syntax highlighting
by Anonymous Monk on Nov 21, 2019 at 07:39 UTC

    I use "darkblue" where I don't care for any particular scheme other than one having decent contrast between text & dark background. (In my own $ENV I have my own color schemes which is not as complete (due to incomplete syntax matching) as the ones included with vim, and I could not care less.) In any case I have found colors for word completion list & comment color (dark blue on black background) to be horrible in the default/no particular scheme (vim 7, 8), and not good enough under "darkblue".

      Forgot that colors for diff are horrible too, so need to be modified ...

      " Change colors for vimdiff to make text readable. if &diff syn off hi clear " Magenta. " Text with no changes. highlight Normal term=none cterm=italic ctermfg=5 ctermbg=0 " Green. " Text added; appears beside text-removed. highlight DiffAdd term=bold,underline cterm=bold ctermfg=2 cter +mbg=0 gui=none guifg=bg guibg=Red " " Red. " Text removed, namely "-----" indicator. highlight DiffDelete term=reverse cterm=bold ctermfg=1 ctermbg=0 + gui=none guifg=bg guibg=Red " White " Text of the line with change. highlight DiffChange term=underline cterm=none ctermfg=7 ctermbg=0 + gui=none guifg=bg guibg=Red " " Yellow. " Changed text. highlight DiffText term=bold cterm=bold ctermfg=3 ctermbg=0 + gui=none guifg=bg guibg=Red endif

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11108906]
Approved by marto
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2021-01-25 08:58 GMT
Find Nodes?
    Voting Booth?