-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to change company-box child-frame background color when circadian switch theme #28
Comments
I was always wandering why I change (defun company-box--display (string)
"Display the completions."
(company-box--render-buffer string)
(unless (company-box--get-frame) ; the already created child-frame exist, so will not apply following new child-frame parameters.
(company-box--set-frame (company-box--make-frame)))
(company-box--set-frame-position (company-box--get-frame))
(unless (frame-visible-p (company-box--get-frame))
(make-frame-visible (company-box--get-frame)))
(company-box--update-scrollbar (company-box--get-frame) t)) So I hope ;; delete old child-frame, then `company-box' create new child-frame.
(delete-frame (company-box--get-frame))
(unless (company-box--get-frame)
(company-box--set-frame (company-box--make-frame)))
(delete-frame (frame-parameter nil 'company-box-doc-frame))
(unless (frame-live-p (frame-parameter nil 'company-box-doc-frame))
(set-frame-parameter nil 'company-box-doc-frame nil)) Here is my current config (as reference for you to considering circadian theme switching case): (setq-default company-box-frame-parameters company-box-frame-parameters)
(defun my:company-box-faces-setup (theme)
"Reload company-box faces on `circadian' `THEME' toggling."
;; delete old child-frame, then `company-box' create new child-frame.
(delete-frame (company-box--get-frame))
(unless (company-box--get-frame)
(company-box--set-frame (company-box--make-frame)))
(delete-frame (frame-parameter nil 'company-box-doc-frame))
(unless (frame-live-p (frame-parameter nil 'company-box-doc-frame))
(set-frame-parameter nil 'company-box-doc-frame nil))
(set-face-attribute 'company-box-candidate nil
:inherit nil
:family (face-attribute 'default :family)
:foreground (face-foreground 'default))
(set-face-attribute 'company-box-selection nil
:inherit 'company-tooltip-selection)
(set-face-attribute 'company-box-background nil
:background (cl-case (alist-get 'background-mode (frame-parameters))
('light "#EBF4FE")
('dark (color-lighten-name (face-background 'default) 4))))
(add-to-list 'company-box-frame-parameters
`(background-color . ,(cl-case (alist-get 'background-mode (frame-parameters))
('light "#EBF4FE")
('dark (color-lighten-name (face-background 'default) 4)))))
(add-to-list 'company-box-frame-parameters
`(foreground-color . ,(face-foreground 'default)))
)
(add-hook 'circadian-after-load-theme-hook #'my:company-box-faces-setup) |
Hi, @sebastiencs any idea on this? can you add some similar workaround for this case which the company-box child-frames is dead, or invalid problems? |
I use package circadian to auto
switch theme. I want company-box child-frame background color can be changed in
circadian switch hook too.
Here is my try:
But this does not work.
When I run
(circadian-setup)
it is white background on 'light theme, or blackbackground color on 'dark theme.
Maybe my set background color way (use
add-to-list
) is wrong?The text was updated successfully, but these errors were encountered: