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

Basic solaire mode functionality #78

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tefkah
Copy link
Contributor

@tefkah tefkah commented May 27, 2021

This PR adds the minimum to work with solaire-mode, which darkens non-file-visiting buffers. The values are picked somewhat arbitrarily, but they look nice I think. Should not conflict with non-solaire-mode users.

Dark
image

Light
image

@rougier
Copy link
Owner

rougier commented May 28, 2021

Thanks! Do you know if it is possible to darken the header line as well in solaire mode?

@tefkah
Copy link
Contributor Author

tefkah commented May 28, 2021

Yes, I've been trying to implement it, but it's been rather difficult due to the way the faces in nano-modeline are implemented. Solaire-mode works by remapping the header-line face for certain buffers, but none of the nano-modeline faces inherit from that face. Additionally, header-line is set to be blank by default, but even after changing this it does not work.

I found a way to make it work, but it's extremely cumbersome:

  1. Set the header-line face to the current colors (nano-face-subtle as background)
  2. In nano-modeline, change all the 'face 'nano-header-default definitions to
`face '(:background (face-background `header-line)
        :foreground (face-foreground `nano-face-header-default)
        :weight (face-attribute`nano-face-header-default :weight))

You cannot simply inherit from nano-face-header-default and just set the background differently, for some reason that does not work.
There's probably a slightly nicer way to do this, but that does not change the nature of it.

The best way would probably be to rewrite nano-headline to use header-line more directly, or to use something else than the strings of concat (propertize) it's has now, but that would be a rather big rewrite, plus kind of against the spirit of nano by not just using the 6 faces.

@tefkah
Copy link
Contributor Author

tefkah commented May 29, 2021

From commit [c43b36](https://github.com/rougier/nano-emacs/pull/78/commits/c4d3b46be3c04af217f2f5debe1ab50ef05552c50 the modeline now updates properly, but it did include changing the modeline function somewhat, but luckily less than I'd feared.

Ideally we would set some new colors for the header-line background and foreground face, the current implementation works alright, but it'd be better to lighten the text in the light-theme somewhat, and darken it in the dark-theme. There's probably some clever function you can write for that, but I don't currently know how to, very happy to hear your suggestions!

Light
image

Dark
image

@rougier
Copy link
Owner

rougier commented May 30, 2021

Wonderful! I'm not sure we can modify the text color without adding a new specific face and I would prefer to avoid that for such a specific case. I think your PR is ready to be merged for me. If you're happy with it, I'll merge.

@tefkah
Copy link
Contributor Author

tefkah commented May 31, 2021

I'm happy enough with it, you can merge it!

@rougier
Copy link
Owner

rougier commented Jun 7, 2021

With the new modeline I managed to have active/inactive face for the header or mode line. Hopefully, this should solved the problem with solaire.

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

Successfully merging this pull request may close these issues.

2 participants