catppuccin / emacs

🍄 Soothing pastel theme for Emacs
MIT License
287 stars 46 forks source link

Org blocks uses green for unstyled syntax when language is set #61

Open Midnight1938 opened 1 year ago

Midnight1938 commented 1 year ago

The syntax for C++ is not highlighted correctly, or has colours that are too similar

Others

purple nord

Catppuccin

2023-02-08T11:46:31,742772803+05:30

nyxkrage commented 1 year ago

Hey đź‘‹

I am actually aware of this, and it seems to be an issue with specifically org-mode source block, that use the normal source block face rather than default for unstyled parts.

I am looking into it, but haven’t found a solution nor workaround yet.

nyxkrage commented 1 year ago

Yeah so all the other themes have the same problem, what is happening with Catppuccin is that both string and the source blocks are green. What purple and nord have is that their source blocks without a language set are just white. As a workaround you can change the color of source blocks to text with

(defun ctp/text-org-blocks ()
   (face-remap-add-relative 'org-block (list :foreground (catppuccin-get-color 'text))))

(add-hook! 'org-mode-hook 'ctp/text-org-blocks)

I'll leave the issue open until a proper solution is found.

nyxkrage commented 1 year ago

This should now be possible to overwrite with org-mode 9.6.4 9.7 when it releases, or if using org-mode straight from main with

(setq org-src-fontify-natively t)
(add-to-list 'org-src-block-faces (list "" (list :foreground (catppuccin-get-color 'green))))

(defun ctp/text-org-blocks ()
  (face-remap-add-relative 'org-block (list :foreground (catppuccin-get-color 'text))))
(add-hook! 'org-mode-hook 'ctp/text-org-blocks)

I will keep this open until I get around to making a PR that has catppuccin automatically set this.

ref: org-mode: Fontify src blocks without lang

nyxkrage commented 2 months ago

org-mode 9.7 has since been released