git.fiddlerwoaroof.com
Browse code

feat: add zenburn to lispworks color themes

Ed L authored on 16/03/2020 18:35:15
Showing 2 changed files
... ...
@@ -14,7 +14,8 @@
14 14
            #:color-theme-args
15 15
            #:color-theme
16 16
            #:define-color-theme
17
-           #:remove-color-theme))
17
+           #:remove-color-theme
18
+           #:zenburn-paren-colors))
18 19
 
19 20
 (in-package #:editor-color-theme)
20 21
 
... ...
@@ -336,5 +337,113 @@
336 337
                                    :solarized-magenta))
337 338
 
338 339
 
340
+(defun hex->color (hex)
341
+  (declare (optimize (speed 3) (safety 1) (debug 1)))
342
+  (check-type hex (string 7))
343
+  (flet ((extract-digits (string start end)
344
+           (check-type string (simple-string 7))
345
+           (parse-integer string
346
+                          :start start
347
+                          :end end
348
+                          :radix 16)))
349
+    (let* ((hex (coerce hex 'simple-string))
350
+           (r (extract-digits hex 1 3))
351
+           (g (extract-digits hex 3 5))
352
+           (b (extract-digits hex 5 7)))
353
+      (color:make-rgb (/ r 255.0)
354
+                      (/ g 255.0)
355
+                      (/ b 255.0)))))
356
+
357
+(eval-when (:compile-toplevel :load-toplevel :execute)
358
+  (defparameter +zenburn-colors+
359
+    `((zenburn-fg+2 ,(hex->color "#FFFFEF"))
360
+      (zenburn-fg+1 ,(hex->color "#F5F5D6"))
361
+      (zenburn-fg ,(hex->color "#DCDCCC"))
362
+      (zenburn-fg-1 ,(hex->color "#A6A689"))
363
+      (zenburn-fg-2 ,(hex->color "#656555"))
364
+      (zenburn-black ,(hex->color "#000000"))
365
+      (zenburn-bg-2 ,(hex->color "#000000"))
366
+      (zenburn-bg-1 ,(hex->color "#111112"))
367
+      (zenburn-bg-05 ,(hex->color "#383838"))
368
+      (zenburn-bg ,(hex->color "#2A2B2E"))
369
+      (zenburn-bg+05 ,(hex->color "#494949"))
370
+      (zenburn-bg+1 ,(hex->color "#4F4F4F"))
371
+      (zenburn-bg+2 ,(hex->color "#5F5F5F"))
372
+      (zenburn-bg+3 ,(hex->color "#6F6F6F"))
373
+      (zenburn-red+2 ,(hex->color "#ECB3B3"))
374
+      (zenburn-red+1 ,(hex->color "#DCA3A3"))
375
+      (zenburn-red ,(hex->color "#CC9393"))
376
+      (zenburn-red-1 ,(hex->color "#BC8383"))
377
+      (zenburn-red-2 ,(hex->color "#AC7373"))
378
+      (zenburn-red-3 ,(hex->color "#9C6363"))
379
+      (zenburn-red-4 ,(hex->color "#8C5353"))
380
+      (zenburn-red-5 ,(hex->color "#7C4343"))
381
+      (zenburn-red-6 ,(hex->color "#6C3333"))
382
+      (zenburn-orange ,(hex->color "#DFAF8F"))
383
+      (zenburn-yellow ,(hex->color "#F0DFAF"))
384
+      (zenburn-yellow-1 ,(hex->color "#E0CF9F"))
385
+      (zenburn-yellow-2 ,(hex->color "#D0BF8F"))
386
+      (zenburn-green-5 ,(hex->color "#2F4F2F"))
387
+      (zenburn-green-4 ,(hex->color "#3F5F3F"))
388
+      (zenburn-green-3 ,(hex->color "#4F6F4F"))
389
+      (zenburn-green-2 ,(hex->color "#5F7F5F"))
390
+      (zenburn-green-1 ,(hex->color "#6F8F6F"))
391
+      (zenburn-green ,(hex->color "#7F9F7F"))
392
+      (zenburn-green+1 ,(hex->color "#8FB28F"))
393
+      (zenburn-green+2 ,(hex->color "#9FC59F"))
394
+      (zenburn-green+3 ,(hex->color "#AFD8AF"))
395
+      (zenburn-green+4 ,(hex->color "#BFEBBF"))
396
+      (zenburn-cyan ,(hex->color "#93E0E3"))
397
+      (zenburn-blue+3 ,(hex->color "#BDE0F3"))
398
+      (zenburn-blue+2 ,(hex->color "#ACE0E3"))
399
+      (zenburn-blue+1 ,(hex->color "#94BFF3"))
400
+      (zenburn-blue ,(hex->color "#8CD0D3"))
401
+      (zenburn-blue-1 ,(hex->color "#7CB8BB"))
402
+      (zenburn-blue-2 ,(hex->color "#6CA0A3"))
403
+      (zenburn-blue-3 ,(hex->color "#5C888B"))
404
+      (zenburn-blue-4 ,(hex->color "#4C7073"))
405
+      (zenburn-blue-5 ,(hex->color "#366060"))
406
+      (zenburn-magenta ,(hex->color "#DC8CC3")))))
407
+
408
+(defmacro with-zenburn-colors (&body body)
409
+  `(let ,+zenburn-colors+
410
+     (declare (ignorable ,@(mapcar 'car +zenburn-colors+)))
411
+     ,@body))
412
+
413
+(with-zenburn-colors
414
+  (define-color-theme "zenburn" ()
415
+    :foreground zenburn-fg
416
+    :background zenburn-bg
417
+    :region `(:foreground ,zenburn-fg+1
418
+              :background ,zenburn-bg+1)
419
+    :show-point-face `(:background ,zenburn-bg+2)
420
+    :interactive-input-face `(:foreground ,zenburn-red)
421
+    :highlight '(:bold-p t)
422
+    :non-focus-complete-face `(:background :tweak_background)
423
+    :font-lock-function-name-face `(:foreground ,zenburn-blue)
424
+    :font-lock-comment-face `(:foreground ,zenburn-fg-1)
425
+    :font-lock-type-face `(:foreground ,zenburn-green)
426
+    :font-lock-variable-name-face `(:foreground ,zenburn-yellow)
427
+    :font-lock-string-face `(:foreground ,zenburn-orange)
428
+    :font-lock-keyword-face `(:foreground ,zenburn-cyan)
429
+    :font-lock-builtin-face `(:foreground ,zenburn-blue+1)
430
+    :compiler-note-highlight `(:foreground ,zenburn-fg+1)
431
+    :compiler-warning-highlight `(:foreground ,zenburn-orange)
432
+    :compiler-error-highlight `(:foreground ,zenburn-red+1)))
433
+
434
+(defun zenburn-paren-colors ()
435
+  (with-zenburn-colors
436
+    (capi:set-editor-parenthesis-colors
437
+     (list zenburn-red
438
+           zenburn-green
439
+           zenburn-blue-1
440
+           zenburn-green+1
441
+           zenburn-blue+1
442
+           zenburn-green+2
443
+           zenburn-orange
444
+           zenburn-cyan
445
+           zenburn-magenta
446
+           zenburn-yellow))))
447
+
339 448
 ;;; Show presence when loaded
340 449
 (pushnew :editor-color-theme *features*)
... ...
@@ -10,7 +10,8 @@
10 10
 
11 11
 (load-init-file "editor-color-theme")
12 12
 
13
-(editor-color-theme:color-theme "solarized-dark")
13
+(editor-color-theme:color-theme "zenburn")
14
+(editor-color-theme:zenburn-paren-colors)
14 15
 
15 16
 (setf (editor:variable-value "Input Format Default")
16 17
       :default)