atlas-engineer / nyxt

Nyxt - the hacker's browser.
https://nyxt-browser.com/
9.91k stars 413 forks source link

More extensible theme/style system #3516

Closed kchanqvq closed 3 weeks ago

kchanqvq commented 2 months ago

Is your feature request related to a problem? Please describe. Currently, the themed-css facility only allows customization of color scheme, and does not provide a fine-grain modular way to define styles. Effect of changes are only visible after reloading a buffer.

Describe the solution you'd like I'm working on an Emacs defface style facility (defstyle) which supports deep customization and realtime reloading. I plan to rewrite the current themed-css uses in Nyxt using defstyle. defstyle itself also require some changes to Nyxt core to work better (handling of prompt buffer, etc). Is this kind of contribution candidate for inclusion?

Additional context Are this kind of significant changes/improvement to Nyxt welcomed at all? If yes, how willing are Nyxt developers to work together to improve the patches until mergeable? What is the feedback time frame I should expect? I'm asking this because I have a few more TODOs like this, however it seems to me that Nyxt is rather unwelcome to open collaboration at this time. I want to make sure everyone's time is productive and well spent. If that's the case, I'll go ahead and maintain my own fork and stop making noise here/waiting for feedbacks. Thank you in advance if you can clarify this!

aadcg commented 2 months ago

Nyxt is undergoing deep architectural changes and theming is something we're not considering at the moment.

We'd be open to proposals after the release of version 4.

Alternatively, it could an extension targeting version 3.

migalmoreno commented 3 weeks ago

Hi @kchanqvq interested on what you mean by "fine-grained modular way to define styles" specifically? I'm also not a big fan of how Nyxt's styles are statically built on startup which prevents runtime theme changes, so I wrote an extension for Nyxt 3 a while ago which supports live theme reload just fine, albeit it's a big hack.

kchanqvq commented 3 weeks ago

Hi @migalmoreno thanks for your interest! I wrote a theme system that allow definitions like

(defstyle keyword `(:color "#d29fa8"))
(defstyle comment `(:color "#a997a0"))
(defstyle echo-area-autodoc
    `((".focus-arg" :inherit keyword)
      (".docstring" :inherit comment)))

and I use my https://github.com/kchanqvq/lwcells to track dependency between styles and propagate the changes when some style is redefined. I once had a prototype in Nyxt but now it has been moved into my own structural editor & browser project, so maybe that will be the right place to discuss once I release it.