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

after using reset color the fade doesnt work #7

Open
Zxpyar opened this issue Oct 21, 2024 · 1 comment
Open

after using reset color the fade doesnt work #7

Zxpyar opened this issue Oct 21, 2024 · 1 comment

Comments

@Zxpyar
Copy link

Zxpyar commented Oct 21, 2024

hello im trying to make an multi tool for fun and i came to the idea to make the number of each tool also faded but i wanted the name of the names white so i used �[37m and at the end �[0m but then the next words arent colored
Is there any way to fix it?
Screenshot 2024-10-21 124731
Screenshot 2024-10-21 124749
added few pictures as u can see the [4] isnt the same color as everything else

@phantomservices21
Copy link

phantomservices21 commented Nov 24, 2024

This problem happens because the reset code \033[0m turns off all colors, including your fade. To fix it, you need to add the fade color back to the numbers after resetting the color for the tool names.

This code should work:

choice = f"""
{purplepink("[0]")} \033[37m» Credits\033[0m                              {purplepink("[4]")} \033[37m» Geolocate\033[0m
{purplepink("[1]")} \033[37m» Token Joiner\033[0m
{purplepink("[2]")} \033[37m» Soon\033[0m
{purplepink("[3]")} \033[37m» Webhook Spammer\033[0m       
"""

(If you are using the purplepink function for the color)

Note: I created a pull request and I hope venax approves it bc it solves a problem (which this code has) where it adds a new line after each line which can sometime mess up code like this. Feel free to paste this code in directly into your file rather than using the function from fade.

def purplepink(text):
    system("")
    faded = ""
    red = 40
    lines = text.splitlines()
    for i, line in enumerate(lines):
        if i < len(lines) - 1:
            faded += (f"\033[38;2;{red};0;220m{line}\033[0m\n")
        else:
            faded += (f"\033[38;2;{red};0;220m{line}\033[0m")
        if not red == 255:
            red += 15
            if red > 255:
                red = 255
    return faded

Don't forget to import os in your file using from os import system

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

No branches or pull requests

2 participants