-
Notifications
You must be signed in to change notification settings - Fork 154
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
New icons seem to have white background #1018
Comments
I can report the same issue. Here's details for my setup. It seems that it's an issue with all the svg icons. macOS M1, using |
Is it possible to disable these fancy directory icons and make all directories display the same "normal" icons? |
EDIT: I was mistaken @Alexander-Miller Any idea why these white-background png images are being used for special directories? I'm using
Really all I'm looking for is a way to go back to the default closed/open directory icon that is being displayed for non-special directories. |
I figured out what is causing these ugly icons to be shown (at least in my case). These icons are being used when the current theme does not provide an override for them. In my case, Anyway my fix was to override the treemacs icon propagation function like so: (use-package treemacs
:bind
(:map global-map
("M-t" . treemacs)
("M-0" . treemacs-select-window))
(:map treemacs-mode-map
;; Otherwise it takes two clicks to open a directory.
([mouse-1] . treemacs-single-click-expand-action))
:hook
;; Don't wrap long lines in Treemacs.
(treemacs-mode . (lambda () (setq-local truncate-lines t)))
:custom
(treemacs-follow-mode 1)
(treemacs-project-follow-mode 1)
(treemacs-filewatch-mode 1)
(treemacs-width 40)
(treemacs-missing-project-action 'remove)
(treemacs-follow-after-init t)
:config
(defun treemacs--propagate-new-icons (_theme))
(use-package treemacs-nerd-icons
:functions treemacs-load-theme
:custom-face
(treemacs-nerd-icons-root-face ((t (:inherit nerd-icons-green :height 1.3))))
(treemacs-nerd-icons-file-face ((t (:inherit nerd-icons-dsilver))))
:config
(treemacs-load-theme "nerd-icons"))
;; By default, treemacs-mode will add itself to `aw-ignored-buffers' which
;; prevents jumping to its window using ace-window. Personally, I prefer
;; being able to treat it just like any other window.
(require 'ace-window)
(setq aw-ignored-buffers (delq 'treemacs-mode aw-ignored-buffers))) |
I confirm that latest did NOT fix it for me either |
I tried changing to the all-the-icons theme and also get ugly icons. I am using spacemacs. |
@kidpollo Did you try following my workaround above? |
Another way is to convert these svg to png (but still keep the suffix name as svg), you may need to install librsvg first. #!/bin/bash
## brew install librsvg
TREEMACS_PATH=$(find ~/.emacs.d/elpa -type d -name 'treemacs-[0-9]*' -print)
TREEMACS_ICONS_PATH="$TREEMACS_PATH/icons/default/vsc"
pushd $TREEMACS_ICONS_PATH
for file in *.svg
do
filename=$(basename $file .svg)
echo $filename
rsvg-convert $filename.svg > $filename.svg.png
mv $filename.svg.png $filename.svg
done
popd Note that this script replaces the original svg file, so you can only run this script once |
Does your Emacs have a general problem with svgs or is it something that treemacs does? Try downloading this image and then insert it like this: Do you also see a white background then? |
@Alexander-Miller On my side no white background in this calendar svg. |
Do you see the red background when you do this?
|
Yes, I can get a red background. |
All right, that is one theory down the drain. Back to digging. Make sure treemacs is open, then run this: (let ((icons (with-current-buffer (treemacs-get-local-buffer) treemacs-icons))
(eval-expression-print-level 999))
(insert (ht-get icons "src-closed"))
(print (ht-get icons "src-closed"))) Does the inserted icon have a white background?
Take the :file that's in the output and pass it to the same code as before:
Does this version of the icon have a white background? |
Hi @Alexander-Miller ! Sorry i've been in holiday. Here is a screenshot of what you have requested so far. That insert seems to produce an error when I replace with that image path for me I get that invalid image size error. Also note on that let form the icon did show with white background. (let ((icons (with-current-buffer (treemacs-get-local-buffer) treemacs-icons))
(eval-expression-print-level 999))
(insert (ht-get icons "src-closed"))
(print (ht-get icons "src-closed")))
;; In *Messages* buffer
;;#(" " 0 1 (img-unselected (image :type imagemagick :file "/Users/paks/.emacs.d/elpa/29.0/develop/treemacs-20230615.1714/icons/default/vsc/dir-src-closed.svg" :scale 1 :ascent center :width 22 :height 22 :transform-smoothing t :background "#282c34") img-selected (image :type imagemagick :file "/Users/paks/.emacs.d/elpa/29.0/develop/treemacs-20230615.1714/icons/default/vsc/dir-src-closed.svg" :scale 1 :ascent center :width 22 :height 22 :transform-smoothing t :background "#21242b") display (image :type imagemagick :file "/Users/paks/.emacs.d/elpa/29.0/develop/treemacs-20230615.1714/icons/default/vsc/dir-src-closed.svg" :scale 1 :ascent center :width 22 :height 22 :transform-smoothing t :background "#282c34"))) [2 times]
(insert "\n" (propertize " " 'display (create-image "/Users/paks/.emacs.d/elpa/29.0/develop/treemacs-20230615.1714/icons/default/vsc/dir-src-closed.svg" 'svg nil)))
;; In *Messages* buffer many times
;; Invalid image size (see ‘max-image-size’) [29 times]
|
Same as @kidpollo here |
Try it with explicit width and height arguments, like this: (insert "\n" (propertize " " 'display (create-image "/home/am/Documents/git/treemacs/icons/default/vsc/dir-src-open.svg" 'svg nil :width 33 :height 33))) Another thing: Is everyone who has this issue on Emacs 29? |
Let's check whether it's something I did with the icons. Download the original one here, and try inserting that. Also is svg a member of your |
Yes to 29 for me too. Thanks for looking into this. Is my conclusion here correct? I.e. that:
Isn't this why the not-so-attractive icons get displayed? Because they're getting pulled from the "Default" theme rather than the (This is somewhat orthogonal to the white background - I guess I'm coming from the angle of using a third-party theme like |
Extending the default theme - or any other theme for that matter - is an opt in feature. You have to explicitly ask for it - see the
It's not just Emacs 29. I have compiled my own v29.0.92 now, and svgs still work fine on my end. I am starting to run out of ideas here. The only thing left for me is to see whether other packages are affected too. If they are you should raise the bug with whoever compiled your Emacs. Another svg-using package is all-the-icon. Clone it, check out the "svg" branch, then run this:
If all-the-icons' svgs don't work either then I think I am officially not to blame. |
I'll keep All the icons theme for now. Its honestly not a bit deal IMO I just wanted to report it because its weird :P Thanks @Alexander-Miller for looking into this feel free to close. |
Good news: I seem to have reproduced the problem, at least I am now seeing black squares instead of svg icons. No idea why now, I don't think I changed anything. The bad news: the icons are to blame. I took them from this repo, and almost every single icon in there shows as a black square for me now with only a few exceptions. Other icons seem to work. I'll keep looking for a replacement, or maybe a version that does work. |
Yay! Thanks
…On Mon, Jul 24, 2023 at 1:28 PM Alexander-Miller ***@***.***> wrote:
Good news: I seem to have reproduced the problem, at least I am now seeing
black squares instead of svg icons. No idea why now, I don't think I
changed anything.
The bad news: the icons are to blame. I took them from this repo
<https://github.com/vscode-icons/vscode-icons>, and almost every single
icon in there shows as a black square for me now with only a few
exceptions. Other icons seem to work. I'll keep looking for a replacement,
or maybe a version that does work.
—
Reply to this email directly, view it on GitHub
<#1018 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAB75VQ36PT2Z23PSZJLB3XR3LGVANCNFSM6AAAAAAW5PAZSQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ugh, I've been trying to check this out for you but I am getting a different error. Where treemacs does not even load the files. I've tried re-installing emacs. Clearing my .emacs, but no dice. I am not sure if it's because of my emacs setup or the latest treemacs-specific issue. This is what I see in
Ill keep poking at this. Not sure how package versions work in emacs but it seems I have |
Yeah, there was a doom modeline related change that borked things for a day or two. That one should be fixed now.
Does it also look like this is you download the image directly and then create an icon yourself like this |
I've now also replaced the src, test, git & github icons with those from svgrepo. |
What if you take the downloaded icon and feed it to treemacs?
You'll need to hit refresh for the change to apply. |
Hmmm nothing happened. Saw the `refresh complete` message and same icon.
Cheers
…On Mon, Aug 21, 2023 at 1:27 PM Alexander-Miller ***@***.***> wrote:
What if you take the downloaded icon and feed it to treemacs?
(treemacs-create-icon :file "~/Downloads/docs-svgrepo-com.svg" :extensions
("docs-closed"))
You'll need to hit refresh for the change to apply.
—
Reply to this email directly, view it on GitHub
<#1018 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAB75XSKM63DCIYZMW3MSTXWPADNANCNFSM6AAAAAAW5PAZSQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ok, enough with the svgs. I've converted the docs icon to a png now. If you can confirm that it works for you as well I'll convert the rest as well. |
I've converted all the svg icons back to pngs. Do things look correct on your end now? |
Loooks beautiful! Thanks for the hard work and sorry for the late response! |
Its weird I the repo seems to show images with transparent background but in my editor they don't seem right :(
Using
Treemacs 3.1
Emacs 29.0.60
Spacemacs develop branch
The text was updated successfully, but these errors were encountered: