• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Other Question] Change dark gray text color to white depending on background/window darkness?

  • 4
    Posts
    5
    Years
    • Seen Mar 6, 2020
    I wasn't sure if this counted as a scripting question or not since according to the forum info you need to know what you're doing to label it like that...and I have no idea what I'm doing. Let me know if I need to change the tag though.

    I'm a complete beginner to Essentials and started playing around with it a couple of days ago, and one thing I noticed was that, even after changing the sign window from its default one with a white background to one with a brown background, the text was still way too dark, making it difficult to read. I already did some googling for another problem I had earlier involving the SpriteWindow script, which looks like it has the answer to this problem too. It talks about determining the color of a background and then determining the text colors to use based on the darkness of the background. However, whatever threshold it is using to determine when to change the dark gray text to white, it's higher than I'd like it to be.

    Basically, I want to lower the threshold so that the script will look at the window color I'm using and go, "Hey, that's too dark for our default dark gray text color. Let's switch the text color to white." Because, at the moment, it's looking at it and saying, "Looks just fine to me."

    After squinting at the script and trying to figure out what it means--I know absolutely nothing about scripting or ruby--I identified a couple areas I think might be the keys to my problem. They mention a return (red*number + green*number + blue*number) < 128 a few times. I figure this means that the red, green, and blue values, times some decimal numbers, or averaged out depending on the area, must add up to below 128, which seems to be the magic number. I noticed it's mentioned a couple of other places, but I think those are only for window dimensions, which isn't what I'm worried about.

    Anyway, I tried increasing the 128 value whenever I saw it paired with this red/green/blue combo, but the text didn't change to white unless I increased it all the way to 255, which I assume is the max. But then the text is white on white backgrounds too, which isn't what I want. So basically I'm stuck.

    This may or may not be an easy fix for those that know how to script but I am not one of those people. I am interested in learning it at some point, but after wasting a few hours already tonight trying to find answers for this problem, I don't think now's a good time to start. And yes, I know you can change the text color for individual events and stuff, but I'm not planning on messing around with colors otherwise so this seems like the better solution.

    Also, some pictures and stuff to help:

    Spoiler:
     
    i see what you wanna do, i personally dont know how to edit the values however colour changse exist, like you mentioned, and while it could be possible to have different grey to white %age based on the background solution would be, find a way to detect the text boxes/choice box option, and have it adjust by default or just have an overall grey or white text (either editing it just by changing the values that you seemed to struggle) or use the /c or /r and /b etc. and remove any text or choice ones that might make it hard to read with your choice. sorry its not much help, but might give you a bump/assist
     
    Well, I don't need the text color to be a percentage of gray to white based on background--that sounds pretty difficult anyway--but more for example "if the background is lighter than medium gray then the text is its default dark gray color and if the background is darker than medium gray then the text color is white." Basically, the text color is either one color or the other, depending on how dark the background is. Sorry if that wasn't clear or I misread your post, btw.

    An overall gray or white text is possible, but since I'm planning on making use of a variety of different windows, I'll probably inevitably find a window it doesn't work with. Like this brown window shown above--if I made the text only a few shades lighter, I think it'd actually look worse with it. Also, I kind of want to stick to the default dark gray or white text color which we see in many of the official games.

    I didn't think of adjusting the text color based on which window is being used. That would also be a good solution for this situation, and maybe even a better one since I can tailor the text color to specific windows that way. I just don't know how I'd go about doing that. 😕

    Thanks for the reply! I'll try to fiddle around with this script a bit more today and see if anything comes of it, maybe see if I can figure out how to implement your suggestions, but if you or anybody else has any other ideas then I'm definitely all ears!
     
    The numbers you found, the two 128 values, are indeed what you need to change. 160 is sufficient for making the text white for your orange speech window, although you may want to increase the number further if you come across a windowskin that still happens to be treated as light (using regular grey text) when you want it to be dark (using white text).

    I'm guessing you changed the windowskin in the Options screen, saw that the text colour didn't change accordingly, and decided it didn't work. If you had closed the Options screen and started some dialogue elsewhere, or even went back into the Options screen, I think the text colour would have changed after all.

    You've come across a problem with the Options screen, in that it doesn't support text colours changing depending on the windowskin (and also it doesn't properly support windowskins of different sizes being used). This is a more involved problem, and it's one I've managed to fix for Essentials v18 (along with a possible improvement to the FPS in this screen). If you're planning to upgrade when it comes out, then you can just live with it for now.
     
    Oops, I completely missed this. Going to have to get used to how this forum shows the "latest reply."

    But thanks for the reply, Maruno! It's good to hear that those numbers are indeed the ones that I need to change.

    And ahh, no, I haven't been changing the window through the Options screen, though that is something to think about too. I've been making it so that when the player character uses the action button on, for example, a wooden sign, it changes the windowskin that is used for that sign to that orange-brown windowskin by using \w[nameofsignfile] in the "show text" of that event.

    I assumed, with my admittedly, zero knowledge of scripting, that by changing the values in SpriteWindow, the text would change color no matter how I determined which windowskin was used, e.g. even if I changed the windowskin through the use of an event, the text would still detect the windowskin color and change accordingly. But now I'm wondering if this would only apply to windowskins changed through the Options menu? Though from what you're saying, it sounds like there are issues there too in this version--forgot to say it earlier, but I'm using v17.2.

    I am probably going to upgrade, yes, so this isn't a huge deal for me, and for now, I've been using \c[8] in the specific events to combat this. However, I'm also using custom location signpost windows, where it would definitely be useful to have the automatic text change. So yeah, if there is a way in this version that I can still make the text color change depending on the background or windowskin darkness, or if that's impossible, please let me know.
     
    Yes, the numbers you found and what I was saying above only apply to the choice of windowskins set in the Options screen. Temporarily changing the windowskin of a single message with \w[X] is completely separate.

    The text colours for each character in a message are all determined before the message starts displaying. Separately, there are other commands (such as playing an SE or displaying a portrait window or changing the windowskin) which only trigger while the message is displaying, which is after the beginning of the message. Thus, all the character text colours are determined assuming the default windowskin (the one chosen in the Options screen) is being used, because the \w[X] command hasn't happened yet.

    Unfortunately you have to change the text colour manually in this case. You may want to look at (broken link removed) which I made, which adds some more colour options and makes editing them a bit easier. \c[12] would be useful to you in this case (assuming all the windowskins available in the Options screen have light backgrounds).
     
    That's disappointing to hear, but I suppose it makes sense too. Especially considering what you're saying about when text colors are determined. In that case, it's no wonder the text color wasn't changing even after adjusting the "128" values. It doesn't look like the location signpost window text is affected by changing the values either, but I assume that's also a separate thing. Maybe I'd have to add something in PField_Visuals under location signpost.

    I'll be sure to check out that resource though. It looks like it has a better array of colors, and if I'm not mistaken, the blue matches up with the blue color used for item category symbols like medicine or key items, so that could be useful too. And the light text option looks exactly like what I'm looking for, as it matches up with the light text used by Essentials when I change the "128" values to "255." The white text I'm currently using has a pale gray shadow instead of that dark gray, which looks less official.

    Thanks for that!
     
    Last edited:
    Back
    Top