git.fiddlerwoaroof.com
Browse code

feat: solarized color theme

Ed Langley authored on 31/10/2020 00:14:57
Showing 1 changed files
... ...
@@ -429,6 +429,99 @@
429 429
   :incremental-search-other-matches-face '(:underline-p t))
430 430
 
431 431
 
432
+(defun make-rgb (red green blue &optional alpha)
433
+  (color:make-rgb (/ red 255s0)
434
+                  (/ green 255s0)
435
+                  (/ blue 255s0)
436
+                  (and alpha (/ alpha 255s0))))
437
+
438
+(defvar *solarized-color-table*
439
+  '(:solarized-base03  (#x00 #x2b #x36)
440
+    :solarized-base02  (#x07 #x36 #x42)
441
+    :solarized-base01  (#x58 #x6e #x75)
442
+    :solarized-base00  (#x65 #x7b #x83)
443
+    :solarized-base0   (#x83 #x94 #x96)
444
+    :solarized-base1   (#x93 #xa1 #xa1)
445
+    :solarized-base2   (#xee #xe8 #xd5)
446
+    :solarized-base3   (#xfd #xf6 #xe3)
447
+    :solarized-yellow  (#xb5 #x89 #x00)
448
+    :solarized-orange  (#xcb #x4b #x16)
449
+    :solarized-red     (#xdc #x32 #x2f)
450
+    :solarized-magenta (#xd3 #x36 #x82)
451
+    :solarized-violet  (#x6c #x71 #xc4)
452
+    :solarized-blue    (#x26 #x8b #xd2)
453
+    :solarized-cyan    (#x2a #xa1 #x98)
454
+    :solarized-green   (#x85 #x99 #x00)))
455
+
456
+(loop for list on *solarized-color-table* by #'cddr
457
+      for name = (first list)
458
+      for rgb = (second list)
459
+      do
460
+         (color:define-color-alias
461
+             name
462
+             (apply #'make-rgb rgb)))
463
+
464
+(define-color-theme "solarized-light" ()
465
+  :foreground :solarized-base00
466
+  :background :solarized-base3
467
+  :region '(:foreground :solarized-base1
468
+            :background :solarized-base3
469
+            :inverse-p t)
470
+  :highlight '(:background :solarized-base2)
471
+  :font-lock-function-name-face '(:foreground :solarized-blue)
472
+  :font-lock-comment-face '(:foreground :solarized-base1 :italic-p t)
473
+  :font-lock-type-face '(:foreground :solarized-yellow)
474
+  :font-lock-variable-name-face '(:foreground :solarized-blue)
475
+  :font-lock-string-face '(:foreground :solarized-cyan)
476
+  :font-lock-keyword-face '(:foreground :solarized-green)
477
+  :font-lock-builtin-face '(:foreground :solarized-green)
478
+  :compiler-note-highlight '(:foreground :solarized-green
479
+                             :bold-p t)
480
+  :compiler-warning-highlight '(:foreground :solarized-orange
481
+                                :bold-p t)
482
+  :compiler-error-highlight '(:foreground :solarized-red
483
+                              :inverse-p t)
484
+  :show-point-face '(:foreground :solarized-cyan
485
+                     :bold-p t :inverse-p t)
486
+  :interactive-input-face '(:foreground :solarized-red)
487
+  :non-focus-complete-face '(:background :solarized-base3)
488
+  :parenthesis-font-face-colours '(:solarized-red
489
+                                   :solarized-base01
490
+                                   :solarized-green
491
+                                   :solarized-orange
492
+                                   :solarized-blue
493
+                                   :solarized-magenta))
494
+
495
+(define-color-theme "solarized-dark" ()
496
+  :foreground :solarized-base0
497
+  :background :solarized-base03
498
+  :region '(:foreground :solarized-base01
499
+            :background :solarized-base03
500
+            :inverse-p t)
501
+  :highlight '(:background :solarized-base02)
502
+  :font-lock-function-name-face '(:foreground :solarized-blue)
503
+  :font-lock-comment-face '(:foreground :solarized-base01 :italic-p t)
504
+  :font-lock-type-face '(:foreground :solarized-yellow)
505
+  :font-lock-variable-name-face '(:foreground :solarized-blue)
506
+  :font-lock-string-face '(:foreground :solarized-cyan)
507
+  :font-lock-keyword-face '(:foreground :solarized-green)
508
+  :font-lock-builtin-face '(:foreground :solarized-green)
509
+  :compiler-note-highlight '(:foreground :solarized-green
510
+                             :bold-p t)
511
+  :compiler-warning-highlight '(:foreground :solarized-orange
512
+                                :bold-p t)
513
+  :compiler-error-highlight '(:foreground :solarized-red
514
+                              :inverse-p t)
515
+  :show-point-face '(:foreground :solarized-cyan
516
+                     :bold-p t :inverse-p t)
517
+  :interactive-input-face '(:foreground :solarized-red)
518
+  :non-focus-complete-face '(:background :solarized-base03)
519
+  :parenthesis-font-face-colours '(:solarized-red
520
+                                   :solarized-base1
521
+                                   :solarized-green
522
+                                   :solarized-orange
523
+                                   :solarized-blue
524
+                                   :solarized-magenta))
432 525
 
433 526
 ;;; Show presence when loaded
434 527
 (pushnew :editor-color-theme *features*)