Skip to content
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

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

Open
Midnight1938 opened this issue Feb 8, 2023 · 4 comments
Open
Labels
bug Something isn't working

Comments

@Midnight1938
Copy link

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
Copy link
Collaborator

nyxkrage commented Feb 8, 2023

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
Copy link
Collaborator

nyxkrage commented Feb 8, 2023

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 nyxkrage changed the title Broken syntax highlighting Org blocks uses green for unstyled syntax when language is set Feb 8, 2023
@NamesCode NamesCode added the bug Something isn't working label Feb 19, 2023
@nyxkrage
Copy link
Collaborator

nyxkrage commented May 17, 2023

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 nyxkrage added the waiting-on-upstream Needs upstream package to be patched label May 17, 2023
@nyxkrage
Copy link
Collaborator

nyxkrage commented Aug 8, 2024

org-mode 9.7 has since been released

@nyxkrage nyxkrage closed this as completed Aug 8, 2024
@nyxkrage nyxkrage removed the waiting-on-upstream Needs upstream package to be patched label Aug 8, 2024
@nyxkrage nyxkrage reopened this Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants