Change color for source code comments

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Change color for source code comments

Woody Wu
after searched through google, i have not found a simple answer of how to
change syntax highlight colors. especially, i want to change the comments
color, that is too dark to see.

i use vim in aterm/xterm without gui. sometimes, on windows, i also remotely
login to linux box for using vim (in the case i set the terminal type to xterm
in the terminal emulator's property).

thanks in advance.

--
steven woody (id: narke)

Celine: Well, who says relationships have to last forever?

        - Before Sunrise (1995)

Reply | Threaded
Open this post in threaded view
|

Re: Change color for source code comments

Tim Chase-2
> after searched through google, i have not found a simple answer of
> how to change syntax highlight colors. especially, i want to change
> the comments color, that is too dark to see.

The simplest way is to find a colorscheme more to your liking.  To try
them out, enter ":colorscheme" followed by a space and then hit
control+D to list the available colorschemes.

If you find one that you like, simply put that line in your ~/.vimrc
file, such as

        colorscheme elflord

If you find one that's close to your liking, but still has room to be
improved, you can copy the file from

$VIMRUNTIME/colors/{colorscheme_name}.vim

to

~/.vim/colors/{custom_name}.vim

and then edit it to meet your wants.  You'll likely want to change the
line that assigns the colorscheme name to the new {custom_name}, which
is likely on a line such as

        :let g:colors_name = "{colorscheme_name}"

You can then modify the colors for your console and GUI as you see fit,
making comments (and possibly other identifiers) easier on your eyes.

For more info, check out

        :help colorscheme

Hope this helps,

-tim




Reply | Threaded
Open this post in threaded view
|

Re: Change color for source code comments

Marian Csontos
In reply to this post by Woody Wu
On Sun, 30 Oct 2005 13:41:59 +0100, Steven Woody <[hidden email]>  
wrote:

> after searched through google, i have not found a simple answer of how to
> change syntax highlight colors. especially, i want to change the comments
> color, that is too dark to see.
>
> i use vim in aterm/xterm without gui. sometimes, on windows, i also  
> remotely
> login to linux box for using vim (in the case i set the terminal type to  
> xterm
> in the terminal emulator's property).
>
> thanks in advance.
>

Hi Steven,

sometimes setting 'background' helps. Some time ago here was a thread  
about detecting it.

Regards,

-- Marian


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
Reply | Threaded
Open this post in threaded view
|

Re: Change color for source code comments

Charles E Campbell Jr
In reply to this post by Woody Wu
Steven Woody wrote:

>after searched through google, i have not found a simple answer of how to
>change syntax highlight colors. especially, i want to change the comments
>color, that is too dark to see..snip
>  
>

Hello!

Three suggestions:

* In your .vimrc, or manually:  : set background=dark (or :set
background=light)
*  Select a colorscheme that works for you (there are plenty on
http://vim.sf.net/)
* Roll your own colorscheme, or modify one: hicolors, available at
   http://vim.sourceforge.net/scripts/script.php?script_id=1081
   visualizes your current colorscheme's standard colors and allows you
to edit them.

Regards,
Chip Campbell

Reply | Threaded
Open this post in threaded view
|

Re: Change color for source code comments

Gary Johnson
On 2005-10-31, "Charles E. Campbell, Jr." <[hidden email]> wrote:

> Steven Woody wrote:
>
> > after searched through google, i have not found a simple answer of how to
> > change syntax highlight colors. especially, i want to change the comments
> > color, that is too dark to see..snip
> >  
> >
>
> Hello!
>
> Three suggestions:
>
> * In your .vimrc, or manually:  : set background=dark (or :set
> background=light)
> *  Select a colorscheme that works for you (there are plenty on
> http://vim.sf.net/)
> * Roll your own colorscheme, or modify one: hicolors, available at
>   http://vim.sourceforge.net/scripts/script.php?script_id=1081
>   visualizes your current colorscheme's standard colors and allows you
> to edit them.

Since Steven said he's using vim in an aterm or xterm, I don't think
setting his colorscheme is going to help.  Unless I'm missing
something, he's pretty much stuck with his aterm's or xterm's
palette.

I, too, have found comments too dark.  In my case, setting
'background' to "dark" changed the comment color from blue to cyan,
which was more readable, but not quite what I wanted.  It also
didn't help the visibility of other applications of blue as a
foreground color, such as SpecialKey.  I wound up changing the
definition of "blue" in my .Xdefaults file to something that was
visible both on a black background and as a background for white
text.

    XTerm*VT100*color4: #70a0ff

I've made a similar adjustment to the blue used by PuTTY, but I
don't have those values handy at the moment.

HTH,
Gary

--
Gary Johnson                 | Agilent Technologies
[hidden email]     | Wireless Division
                             | Spokane, Washington, USA
Reply | Threaded
Open this post in threaded view
|

Re: Change color for source code comments

Charles E Campbell Jr

Steven Woody wrote:
 >after searched through google, i have not found a simple answer of how to
 >change syntax highlight colors. especially, i want to change the comments
 >color, that is too dark to see..snip

On 2005-10-31, "Charles E. Campbell, Jr." <[hidden email]> wrote:
 >Three suggestions:
 >
 >* In your .vimrc, or manually:  : set background=dark (or :set
 >background=light)
 >*  Select a colorscheme that works for you (there are plenty on
 >http://vim.sf.net/)
 >* Roll your own colorscheme, or modify one: hicolors, available at
 >  http://vim.sourceforge.net/scripts/script.php?script_id=1081
 >  visualizes your current colorscheme's standard colors and allows you
 >to edit them.
 >

Gary Johnson wrote:
 >Since Steven said he's using vim in an aterm or xterm, I don't think
 >setting his colorscheme is going to help.  Unless I'm missing
 >something, he's pretty much stuck with his aterm's or xterm's
 >palette.
...snip

The astronaut colorscheme,
http://vim.sourceforge.net/scripts/script.php?script_id=122,
is designed to work with console vim in an xterm; ie. it is limited to
using 8 colors.  It also
supports gvim using the same set of colors to permit a consistent look.  
I prefer and the
astronaut colorscheme supports a dark background, by the way.

I remember seeing some other colorscheme (whose name I don't remember)
that also
supported console.  It may have been a 256-color xterm support, though.

Regards,
Chip Campbell

Reply | Threaded
Open this post in threaded view
|

Re: Change color for source code comments

A.J.Mechelynck
Charles E. Campbell, Jr. wrote:
>
> Steven Woody wrote:
>>after searched through google, i have not found a simple answer of how to
>>change syntax highlight colors. especially, i want to change the comments
>>color, that is too dark to see..snip
[...]

> The astronaut colorscheme,
> http://vim.sourceforge.net/scripts/script.php?script_id=122,
> is designed to work with console vim in an xterm; ie. it is limited to
> using 8 colors.  It also
> supports gvim using the same set of colors to permit a consistent look.
> I prefer and the
> astronaut colorscheme supports a dark background, by the way.
>
> I remember seeing some other colorscheme (whose name I don't remember)
> that also
> supported console.  It may have been a 256-color xterm support, though.
>
> Regards,
> Chip Campbell
In any case, Steve, if you don't find a colorscheme exactly to your
liking, you can always "roll your own", and in that case you can write
for any or all of monochrome terminals (term=...), color console
terminals (cterm=... ctermbg=... ctermfg=...), and GUI displays (gui=...
guifg=... guibg=...). I'm attaching a very small colorscheme of mine,
which leaves most (but not all) colours at their defaults; it will
probably not be exactly what you want but you may use it as a source of
inspiration. Like all user-made colorschemes, it belongs in the colors
subdirectory of a directory listed before $VIMRUNTIME in the
'runtimepath' option setting (e.g., in $VIM/vimfiles/colors/).

Best regards,
Tony.

hi clear Normal
set bg&
hi clear

if exists("syntax_on")
        syntax reset
endif

let colors_name = "almost-default"

" start non-default highlight settings
" hi clear Error
hi StatusLine gui=NONE,bold guibg=red guifg=white
hi Visual gui=NONE guibg=#E0E0E0 guifg=NONE
hi Error guibg=#FF3333 guifg=Black
hi clear ErrorMsg
hi link ErrorMsg Error
hi Search guifg=Black
hi Constant guifg=#F020C0
if &bg == "dark"
 hi Comment ctermfg=cyan
 hi Statement ctermfg=yellow
 hi Constant ctermfg=magenta
 hi Identifier ctermfg=green
endif
" hi IncSearch gui=NONE guibg=#999999
" end highlight settings