Loading ...
Sorry, an error occurred while loading the content.

Re: change display colors. which rule causes which color?

Expand Messages
  • geoffrey.wood@thomsonreuters.com
    ... I have the same problem with dark blue. ... (Using Windows - not sure if this applies under other OSs.) Most colours are ultimately defined in
    Message 1 of 7 , Oct 2, 2012
    • 0 Attachment
      On Monday, 1 October 2012 23:33:17 UTC+1, Gelonida N wrote:
      > The problem is, that all dark blue colors are very difficult to recognize.
      > Ideally I'd like to change all dark blue vim colors into a lighter blue
      > or another color.

      I have the same problem with dark blue.

      > Is there an easy way to globally change one color with another[?]

      (Using Windows - not sure if this applies under other OSs.)
      Most colours are ultimately defined in vim\vim73\rgb.txt (if
      you're using VIM 7.3 of course).

      You can simply define your own colour in there and then use
      it in your colourscheme or whereever. I add this line

      0 96 255 BobBlue

      and then use it in my colourscheme:

      exe 'hi SpecialKey guifg=BobBlue'
      exe 'hi NonText guifg=BobBlue gui=NONE'
      if !exists("$TERM")
      hi SpecialKey ctermbg=DarkBlue ctermfg=White
      hi NonText ctermbg=DarkBlue ctermfg=White
      endif

      You can define it directly in the colourscheme and avoid the
      "exe" complication but then you can't use it in all other places,
      as far as I could tell.

      Since it doesn't work in DOS terminals I use DarkBlue
      background with White text there instead.

      You might be able to just edit the DarkBlue colour instead.
      You'd have to try that to see. Some core colours
      are defined elsewhere though - for example replace all the
      colours in rgb.txt with 77 77 77 and gvim still shows the
      colours like "red" as usual, although "red" is one of the
      lines in the file.

      Another problem is that rgb.txt is kept alongside the
      executable and so upgrades to the vim version will lose your
      changes. You'd expect there to be a way to define your own
      colours under $VIMRUNTIME, e.g., include your own rgb.txt
      there and have it added to the main colours, but I couldn't
      find such a method.

      Therefore I have the code below at the start of my _vimrc,
      and I keep my BobBlue colour and other colours in the file
      $VIMRUNTIME\rgb.txt

      It doesn't feel very elegant and there's possibly a better
      way to do it - works for me though.

      regards,
      Geoff

      " Update rgb.txt with my custom colours - if they don't
      " exist

      " read in my colours and default colours from the file
      let s:my_colours = readfile($VIM . "\\vimfiles\\rgb.txt")
      let s:rgb_file = readfile($VIMRUNTIME . "\\rgb.txt")

      let s:added_colours = 0
      " for each of my colours
      for s:my_colour in s:my_colours
      let s:found=0
      " for each of the default colours...
      for s:line in s:rgb_file
      "...found my colour?
      if s:line =~ s:my_colour
      let s:found=1
      break
      endif
      endfor
      "if didn't find my colour...
      if s:found==0
      " ... add it to the default colours
      let s:rgb_file += [s:my_colour]
      let s:added_colours += 1
      endif
      endfor
      " if we changed the default colours, update the file
      if s:added_colours > 0
      call writefile(s:rgb_file, $VIMRUNTIME . "\\rgb.txt")
      endif

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Charles Campbell
      ... Check out hicolors -- http://www.drchip.org/astronaut/vim/index.html#HICOLORS (cutting edge) http://vim.sourceforge.net/scripts/script.php?script_id=1081
      Message 2 of 7 , Oct 3, 2012
      • 0 Attachment
        Gelonida N wrote:
        > I'm having terminal-windows with dark backgrounds.
        >
        > The problem is, that all dark blue colors are very difficult to
        > recognize.
        >
        > Ideally I'd like to change all dark blue vim colors into a lighter
        > blue or another color.
        >
        >
        > My Questions:
        >
        > Is there an easy way to globally change one color with another.
        >
        > Alternatively.
        >
        > If I see something in a color, that I don't like.
        >
        > Is there any way to place my cursor on the 'badly' coloured word and
        > find out which rule set the color for that word?
        >
        Check out hicolors --

        http://www.drchip.org/astronaut/vim/index.html#HICOLORS (cutting
        edge)
        http://vim.sourceforge.net/scripts/script.php?script_id=1081 (stable)

        It gives help for highlighting colors by showing the name of the
        highlight in
        its currently selected color. Left-clicking on that color name will
        bring you
        to the help for it, and right-clicking on it will bring up a color editor.

        Also, I suggest looking into using hilinks.vim:

        http://www.drchip.org/astronaut/vim/index.html#HILINKS

        This plugin provides a syntax stack trace and a highlighting stack trace
        as you move your cursor about. In other words, as you move your cursor
        about, hilinks will identify which syntax highlighting group is
        responsible for what you see.

        Regards,
        C Campbell


        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      Your message has been successfully submitted and would be delivered to recipients shortly.