Category Archives: General Coding

The color of your comments

Recently I had a thought that the comments in my code may be getting in the way of me actually seeing the code itself while I’m coding. There seems to be two camps in the code commenting world: (1) Write good code and you should not need comments and (2) Write comments or else you are being lazy and no one will ever be able to work with your code. Well, I’m not here to settle that debate (I fall somewhere in the middle).

So, I had this idea of changing the COLOR of my comments from GREEN to GREY, so that I could still see them, but they would kind of fade away into the background, but would still be there if I took a harder look. I suppose the default VFP comment color must be that classic green color that I’ve been looking at for years, so I’ve changed mine to grey to help me focus better on my code, and not the comments.

Who knows, maybe one day I’ll be a real programmer and won’t even need to write comments at all.

Also, the smart one, Bo Durban, posted this hint on UT (in response to this blog post) about how you are not limited to the base 16 colors:

Did you know…If you set it programmatically, you are not limited to the base 16 colors?:

oReg = NEWOBJECT("FoxReg",HOME(2)+"classes\registry.prg")
oReg.SetFoxOption("EditorCommentColor","RGB(80,140,80,250,250,170),NoAuto,NoAuto")
SYS(3056,1)

So, here are a few screenshots to compare… Give it a try and see what you think.

Grey Comments: Green Comments: