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

Error Message Color #85

Open
kvnduff opened this issue May 7, 2022 · 5 comments
Open

Error Message Color #85

kvnduff opened this issue May 7, 2022 · 5 comments

Comments

@kvnduff
Copy link

kvnduff commented May 7, 2022

Just wondering if there is a way to customize the color of the error message. In your gif it displays as light pink as it does in my rofi theme. I have tried changing relevant colors in the rofi theme but can't find the relevant variable. Thanks for your work on this project. :)

@svenstaro
Copy link
Owner

Hey, sorry to have this ignored for so long. Are you still experiencing this problem? Are you sure this is a rofi-calc question or maybe a general rofi question?

@sornig
Copy link
Contributor

sornig commented Apr 16, 2024

I'm also having trouble accomplishing that. Changing the text-color for textbox to inherit and specifying a text-color for message allows me to change the color of the Result: field. However, when the calculator throws an error, it shows up (in the same place) in pink.

I found this line in the source code that defines the color for the error message as PaleVioletRed, which is the color I see when an error comes up:

return g_markup_printf_escaped("<span foreground='PaleVioletRed'>%s</span>", pd->last_result);

Reading through the man pages, from what I understand, both the message and error-message boxes use the textbox child. In theory, setting a text-color for error-message should resolve the issue, as it also uses the textbox as its child, but that isn't the case.
Reading this section in rofi-theme(5) though, the error-message seems to only be used in a standalone context. The above <span> element is therefore probably, for lack of a better word, "injected" into message's child textbox (the place where the calculator's results are printed).

tl;dr error-message is probably irrelevant; It seems like the foreground= property for the calculator errors in src/calc.c#615 is overwriting the text-color I have set for the textbox { } in my config.rasi file.

@svenstaro
Copy link
Owner

Oh right. Happy for a PR that fixes this if you'd like to take a look!

@sornig
Copy link
Contributor

sornig commented Apr 16, 2024

Maybe one approach could be to replace PaleVioletRed with a variable. I have absolutely no idea how to make it configurable through config.rasi, but I could try to implement it as a command option - at least temporarily until someone comes up with a better solution. I am thinking:

rofi -show calc -modi calc -calc-error-color '#ff0000' -no-show-match -no-sort

(I should probably add: I am absolutely not familiar with rofi plugin development and the rofi codebase in general, so right now I fear this is as far as I can go)

@sornig
Copy link
Contributor

sornig commented Apr 17, 2024

A few hours of tinkering later... it works! #121

As I said, it's just a quick implementation, but it'll do for now. If someone wants to / is capable of writing a proper implementation (with .rasi support) that would be nice.

I only tested it with lbonn/rofi on Void Linux (Wayfire), but I don't see why it wouldn't work on X11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants