Juan Fuentes avatar Juan Fuentes committed 5bee959

Created a macro (jj/set-colors) to set the colors avoiding code duplication.
Added code to generate a light and dark colors.

Comments (0)

Files changed (2)

site-lisp/defuns.el

 ;;
 ;;; Code:
 
+(require 'cl nil t)
+
 (defun jj/compile-config()
   (interactive)
   (byte-recompile-directory *site-lisp* 0))
                     ,@body))
                commands)))
 
+;; macro to generate my colors.
+(defmacro* jj/set-colors (func &key (background "White")
+                               (foreground "Black")
+                               (region "lightgoldenrod")
+                               (cursor "Black")
+                               (width 163)
+                               (height 53))
+  `(defun ,func ()
+     (interactive)
+     (set-background-color ,background)
+     (set-foreground-color ,foreground)
+     (set-cursor-color ,cursor)
+     (set-face-background 'region ,region)
+     (set-frame-size (selected-frame) ,width ,height)
+     (set-frame-position (selected-frame) 0 0)
+     (setq default-frame-alist '((left-fringe . 0)
+                                 (right-fringe . 0)
+                                 (width . ,width)
+                                 (height . ,height)
+                                 (background-color . ,background)
+                                 (foreground-color . ,foreground)
+                                 (region . ,region)
+                                 (cursor-color . ,cursor)))))
+
 (provide 'defuns)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

site-lisp/frames.el

         nil
       t))
 
-  ;; Function to set up my default color combination.
-  (defun jj/set-colors()
-    "Set my favorite color combination."
-    (interactive)
-    (jj/black-on-white))
+  ;; light colors
+  (jj/set-colors jj/light-theme)
+
+  ;; dark colors
+  (jj/set-colors jj/dark-theme
+                 :background "Black"
+                 :foreground "Grey73"
+                 :region "Blue"
+                 :cursor "Grey73")
 
-  (defun jj/black-on-white()
-    "Black on white foreground"
-    (interactive)
-    (set-background-color "White")
-    (set-foreground-color "Black")
-    (set-cursor-color "Black")
-    ;; (set-face-attribute 'mode-line nil :height 85 :font *font* :height 110 :slant 'normal :weight 'bold)
-    ;; (set-face-attribute 'mode-line-inactive nil :height 85 :font *font* :height 111 :slant 'normal :weight 'bold)
-    (setq default-frame-alist '((left-fringe . 0)
-                                (right-fringe . 0)
-                                (background-color . "White")
-                                (foreground-color . "Black")
-                                (cursor-color . "Black"))))
-
-  (defun jj/grey-on-black()
-    "Grey on black foreground"
-    (interactive)
-    (set-background-color "Black")
-    (set-foreground-color "Grey73")
-    (set-cursor-color "Grey73")
-    ;; (set-face-attribute 'mode-line nil :height 85 :font *font* :height 106 :slant 'normal :weight 'bold)
-    ;; (set-face-attribute 'mode-line-inactive nil :height 85 :font *font* :height 106 :slant 'normal :weight 'bold)
-    (setq default-frame-alist '((left-fringe . 0)
-                                (right-fringe . 0)
-                                (background-color . "Black")
-                                (foreground-color . "Grey73")
-                                (cursor-color . "Grey73"))))
 
   (set-fringe-mode 0)
   (blink-cursor-mode -1)
-  (jj/set-colors)
+  (jj/light-theme)
 
   ;; disable scroll-bar and tool-bar
   (dolist (mode '(scroll-bar-mode tool-bar-mode))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.