doomemacs / themes

A megapack of themes for GNU Emacs.
MIT License
2.18k stars 395 forks source link

mis alignment of icons and text when using treemacs theme #391

Closed CSRaghunandan closed 4 years ago

CSRaghunandan commented 4 years ago

Attached is a screnshot for reference. The original theme for treemacs does not have this issue. This affects both treemacs and treemacs-dired-icons-mode

screenshot-2020-02-03_08-10-34

ema2159 commented 4 years ago

This is the same issue as #387. It cannot be fixed given it's a problem specific to all-the-icons.

hlissner commented 4 years ago

Actually, we may be able to address it. The issue lies in the doom-colors theme introduced in #347. The default doom-atom theme works fine:

image

Looking at the doom-colors theme, there are no :height properties in use.

@CSRaghunandan Does this fix the issue?

(require 'treemacs)
(treemacs-create-theme "doom-colors"
  :extends "doom-atom"
  :config
  (progn
    (treemacs-create-icon
     :icon (format " %s\t" (all-the-icons-octicon "repo" :height 1.2 :v-adjust -0.1 :face 'doom-themes-treemacs-root-face))
     :extensions (root))
    (treemacs-create-icon
     :icon (format "%s\t" (all-the-icons-octicon "flame" :height 0.8 :v-adjust 0 :face 'all-the-icons-red))
     :extensions (error))
    (treemacs-create-icon
     :icon (format "%s\t" (all-the-icons-octicon "stop" :height 0.8 :v-adjust 0 :face 'all-the-icons-yellow))
     :extensions (warning))
    (treemacs-create-icon
     :icon (format "%s\t" (all-the-icons-octicon "info" :height 0.75 :v-adjust 0.1 :face 'all-the-icons-green))
     :extensions (info))
    (treemacs-create-icon
     :icon (format "  %s\t" (all-the-icons-alltheicon "git" :height 0.85 :face 'all-the-icons-red))
     :extensions ("gitignore" "git" "gitconfig" "gitmodules"))

    (dolist (item all-the-icons-icon-alist)
      (let* ((extensions (doom-themes--get-treemacs-extensions (car item)))
             (func (cadr item))
             (args (append (list (caddr item)) '(:v-adjust -0.05 :height 0.85) (cdddr item)))
             (icon (apply func args)))
        (let* ((icon-pair (cons (format "  %s\t" icon) " "))
               (gui-icons (treemacs-theme->gui-icons treemacs--current-theme))
               (tui-icons (treemacs-theme->tui-icons treemacs--current-theme))
               (gui-icon  (car icon-pair))
               (tui-icon  (cdr icon-pair)))
          (--each extensions
            (ht-set! gui-icons it gui-icon)
            (ht-set! tui-icons it tui-icon)))))))
(treemacs-load-theme "doom-colors")
ema2159 commented 4 years ago

@hlissner. You're right, that's a solution but I think it's more like a workaround. The core issue is the fonts that all-the-icons use, and that as I understand, it's pretty difficult to solve. I think the problem has been addressed several times in all-the-icons's repo, however, nobody has come with a proper solution yet.

ema2159 commented 4 years ago

Although... wait a minute. @seagle0128, how do you align the .gitignore file here #347?

hlissner commented 4 years ago

It's aligned because the icons next to it are from the same iconset (with the same size problem). If you look at the grey icons (from the octicons set), they're unaligned. In our themes we are setting :height for all our icons, so they are a good deal smaller.

EDIT: Oh, the octicons iconset is just naturally smaller, too.

The solution would be to stop manipulating :height blow up the octicon icons or shrink the colored filetype icons.

ema2159 commented 4 years ago

Yes, that's the problem, the default font sizes are inconsistent and there's several file icons that come from other fonts such as the go icon for example (although I think there's an alternative one that can be used instead, I'll submit a PR requesting to change it. It's even more visible than the current one).

hlissner commented 4 years ago

Alright. In the meantime I've done some triage in 9549c7c.

image

@CSRaghunandan Let me know if that doesn't help and I'll reopen the issue.

CSRaghunandan commented 4 years ago

Alright. In the meantime I've done some triage in 9549c7c.

image

@CSRaghunandan Let me know if that doesn't help and I'll reopen the issue.

Thanks a lot for the quick response and fix. I'll check it out and get back to you.

seagle0128 commented 4 years ago

Although... wait a minute. @seagle0128, how do you align the .gitignore file here #347?

I think it may be related to the font faamily. The icons are aligned iwith menlo and SF mono in my MacBook.

CSRaghunandan commented 4 years ago

@hlissner seems to be fixed after the latest commit.

Thank you :)

glepnir commented 4 years ago

Nice work! @hlissner

CSRaghunandan commented 4 years ago

@hlissner tab-width is not set to 1 when doom-themes-emacs-config is enabled. I have to set it to 1 manually for it to look clean. You might want to look at this again.

Thanks