gyscos / gyscos/cursive

Color styling problem

Open
#253 7 comments 0 reactions 0 assignees View on GitHub
enhancement internals themes
Dominant language
Rust
Stars
4.8k
Forks
270
Avg merge
5d 19h
Merged PRs (30d)
2

Description

Hi,

this is going to be a little controversial: I spend a lot of time while working with Cursive in a very non-effective way trying to get desired coloring of views. Since the styling (like applying effects, using different colors from Palette) is usually determined by the code of View::draw(...) method, I am forced to either create wrappers that modify a theme to each view in separate or fork the entire view and manually modify the drawing method. That obviously increases cost of development and maintenance, especially with complex third party views.

In views I write, I decided to move away from predefined palette, and created something like a "style tree", where I just override colors with html color codes defined in JSON. If other (default, third party etc) views used similar technique, I would be able to achieve required styling very fast, in a way a little similar to CSS.

Would that be something you could consider for Cursive? If you are open to discussion I can make a design draft. I am thinking about something like this: https://github.com/njskalski/sly-editor/blob/master/src/default_settings.rs (theme part) but more streamlined. Like "cascading, json defined themes", that could be deserialized into objects via serde_json, so one can either configure in-code or via json.

I we'd agree on some format, I could help you to update the views, and fork and update some third party views, even help with maintaining.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.