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

Dim org-mode's headings leading stars #30

Closed
titibandit opened this issue Aug 21, 2021 · 2 comments
Closed

Dim org-mode's headings leading stars #30

titibandit opened this issue Aug 21, 2021 · 2 comments

Comments

@titibandit
Copy link

In an org-mode file, you can "hide" the leading stars of a heading, by using the org-hide face. The foreground of this face is supposed to be equal to the background of the frame, this way, the leading stars won't be visible.
Only thing is that, with auto-dim, the background color of the frame changes, while the org-hide face doesn't change.
I could make it work, as you can see here: https://git.titibandit.eu/thibaut/auto-dim-other-buffers.el/commit/047280b3735a1c351f4bbe4f22cad47938e70b89
But there, I've hardcoded the color of my background, I'm not sure how I can automatically retrieve the dimmed background color. When this is achieved, maybe we can merge this in here?

For reference, without the fix, dimmed org-mode buffers look like this:
Org hide

@listx
Copy link

listx commented Oct 20, 2021

I did it like this:

(add-hook 'org-mode-hook 'l/org-colors)
(defun l/org-colors ()
  (add-to-list 'face-remapping-alist '(org-hide (:filtered (:window adob--dim t) (:foreground "#1c1c1c")) org-hide))
  (add-to-list 'face-remapping-alist '(org-block (:filtered (:window adob--dim t) (:background "#262626")) org-block)))

Of course you'll have to adjust the colors to your own theme as necessary.

EDIT: The trick was to look at the face-remapping-alist variable definition. I just mirrored what was already in there for the default face (modified by auto-dim-other-buffers). FWIW here's what the variable looks like in my org buffer:

((org-block
  (:filtered
   (:window adob--dim t)
   (:background "#262626"))
  org-block)
 (org-hide
  (:filtered
   (:window adob--dim t)
   (:foreground "#1c1c1c"))
  org-hide)
 (default
   (:filtered
    (:window adob--dim t)
    auto-dim-other-buffers-face)
   default))

@mina86
Copy link
Owner

mina86 commented Nov 1, 2021

Sorry it took so long. I’ve added auto-dim-other-buffers-hide-face in the most recent release (soon available on MELPA I’m guessing). Once it’s customised such that it’s foreground and background match desired dimmed background, org-hide will work with no further issues. Any other faces which need similar treatment can be added by editing auto-dim-other-buffers-affected-faces list.

@mina86 mina86 closed this as completed Nov 1, 2021
mina86 added a commit that referenced this issue Nov 1, 2021
Add ‘auto-dim-other-buffers-hide-face’ which has foreground and
background set to the same colour.  In effect, text rendered using
that face is invisible.

This is intended as a remapping for faces which hide the text such as
‘org-hide’ face (which otherwise show the text when window is dimmed).

The face is added to ‘auto-dim-other-buffers-affected-faces’ list as
a remapping for ‘org-hide’ but any other faces which are meant to hide
the text may need to be added separately to that list.

Fixes: #30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants