Skip to content

Commit

Permalink
Merge pull request #1458 from jfaz1/theme-fixes
Browse files Browse the repository at this point in the history
Expose modeline attributes, various theme fixes
  • Loading branch information
cxxxr authored Jul 28, 2024
2 parents c305cba + 3a8d210 commit 1fc063d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 47 deletions.
47 changes: 19 additions & 28 deletions extensions/lisp-mode/paren-coloring.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
(:export :paren-coloring
:*paren-attribute*
:*rainbow*
:paren-color-1
:paren-color-2
:paren-color-3
:paren-color-4
:paren-color-5
:paren-color-6
:toggle-paren-coloring))
(in-package :lem-lisp-mode/paren-coloring)

Expand All @@ -15,40 +21,25 @@
(enable)
(disable))))

(defvar *default-rainbow-colors* #("red" "blue" "green" "sienna4" "dark cyan" "orange"))
(define-attribute paren-color-1
(t :foreground "red"))

(defun rainbow-color (index)
(let ((color-theme (find-color-theme (current-theme))))
(if color-theme
(get-color-theme-color color-theme
(ecase index
(0 :base08)
(1 :base09)
(2 :base0a)
(3 :base0b)
(4 :base0c)
(5 :base0d)))
(aref *default-rainbow-colors* index))))
(define-attribute paren-color-2
(t :foreground "blue"))

(define-attribute color-1
(t :foreground (rainbow-color 0)))
(define-attribute paren-color-3
(t :foreground "green"))

(define-attribute color-2
(t :foreground (rainbow-color 1)))
(define-attribute paren-color-4
(t :foreground "sienna4"))

(define-attribute color-3
(t :foreground (rainbow-color 2)))
(define-attribute paren-color-5
(t :foreground "dark cyan"))

(define-attribute color-4
(t :foreground (rainbow-color 3)))
(define-attribute paren-color-6
(t :foreground "orange"))

(define-attribute color-5
(t :foreground (rainbow-color 4)))

(define-attribute color-6
(t :foreground (rainbow-color 5)))

(defparameter *rainbow-colors* #(color-1 color-2 color-3 color-4 color-5 color-6))
(defparameter *rainbow-colors* #(paren-color-1 paren-color-2 paren-color-3 paren-color-4 paren-color-5 paren-color-6))

(defvar *paren-attribute* (make-attribute :foreground "dim gray"))

Expand Down
3 changes: 0 additions & 3 deletions src/color-theme.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

(defvar *color-themes* (make-hash-table :test 'equal))

(defvar *theme-load-hook* nil)

(defun find-color-theme (name)
"Takes the name of an existing color theme and returns a color-theme hashtable"
(gethash name *color-themes*))
Expand Down Expand Up @@ -95,7 +93,6 @@
(editor-error "undefined color theme: ~A" name))
(apply-theme theme)
(message nil)
(run-hooks *theme-load-hook* theme)
(redraw-display :force t)
(setf (current-theme) name)
(when save-theme
Expand Down
15 changes: 0 additions & 15 deletions src/ext/frame-multiplexer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@
(define-attribute frame-multiplexer-background-attribute
(t :foreground "white" :background "#262626"))

(add-hook lem-core:*theme-load-hook*
(lambda (theme)
(let ((lighter-background (get-color-theme-color theme :base01))
(dark-foreground (get-color-theme-color theme :base04))
(selected-background (get-color-theme-color theme :base0A)))
(unless (get-color-theme-color theme 'frame-multiplexer-active-frame-name-attribute)
(set-attribute 'frame-multiplexer-active-frame-name-attribute
:foreground lighter-background :background selected-background :bold t))
(unless (get-color-theme-color theme 'frame-multiplexer-frame-name-attribute)
(set-attribute 'frame-multiplexer-frame-name-attribute
:foreground lighter-background :background dark-foreground :bold t))
(unless (get-color-theme-color theme 'frame-multiplexer-background-attribute)
(set-attribute 'frame-multiplexer-background-attribute
:foreground selected-background :background lighter-background)))))

(define-editor-variable frame-multiplexer nil ""
(lambda (value)
(if value
Expand Down
12 changes: 11 additions & 1 deletion src/internal-packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@
:modeline-mode-names
:modeline-position
:modeline-posline
:modeline-name-attribute
:modeline-major-mode-attribute
:inactive-modeline-major-mode-attribute
:modeline-minor-modes-attribute
:inactive-modeline-minor-modes-attribute
:modeline-position-attribute
:inactive-modeline-position-attribute
:modeline-posline-attribute
:inactive-modeline-position-attribute
:inactive-modeline-name-attribute
:inactive-modeline-posline-attribute
:convert-modeline-element)
;; command.lisp
(:export
Expand Down Expand Up @@ -583,7 +594,6 @@
:define-color-theme
:load-theme
:current-theme
:*theme-load-hook*
:find-color-theme
:color-theme
:get-color-theme-color)
Expand Down

0 comments on commit 1fc063d

Please sign in to comment.