Emacs on a Linux Console

How to get the best colors in emacs console mode?

If you are using emacs connected a distance with a client like let say Putty, it's best to configure Putty's windows colors and set a foreground and background color as you like.

Then you can have you emacs file (.emacs) like this:

;;; PHP-mode
(require 'php-mode)
(add-hook 'php-mode-user-hook 'turn-on-font-lock)
(add-hook 'php-mode-user-hook
'(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends")))

(autoload 'javascript-mode "javascript-mode" "JavaScript mode" t)
(setq auto-mode-alist (append '(("\\.js$" . javascript-mode))
auto-mode-alist))

(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(global-font-lock-mode t nil (font-lock))
'(javascript-mode-hook nil t)
'(make-backup-files nil)
'(tab-always-indent t)
'(tab-width 4))
(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
)

 

;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; MY .EMACS COLORS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;

;; general text color
(set-foreground-color "DarkBlue")

;; comment color
(set-face-foreground 'font-lock-comment-face "DarkGreen" )
(set-variable font-lock-comment-face 'font-lock-comment-face)

;; string color
(set-face-foreground 'font-lock-string-face "Magenta" )
(set-variable font-lock-string-face 'font-lock-string-face)

;; function name color
(set-face-foreground 'font-lock-function-name-face "Blue" )
(set-variable font-lock-function-name-face 'font-lock-function-name-face)

;; keyword color
(set-face-foreground 'font-lock-keyword-face "Orange" )
(set-variable font-lock-keyword-face 'font-lock-keyword-face)

;; variable name color
(set-face-foreground 'font-lock-variable-name-face "RoyalBlue" )
(set-variable font-lock-variable-name-face 'font-lock-variable-name-face)

;; Type color
(set-face-foreground 'font-lock-type-face "Brown" )
(set-variable font-lock-type-face 'font-lock-type-face)

;; Reference color ? this doesn't work
;;(set-face-foreground 'font-lock-reference-face "Purple" )
;;(set-variable font-lock-reference-face 'font-lock-reference-face)

;; Courier New font of size 10 and font style Regular: if you want bold, change normal to bold here
(set-default-font "-*-Courier New-normal-r-*-*-12-*-*-*-c-*-*-iso8859-1")

;;to set background color to white
(set-background-color "LightBrown")