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

More intuitive color use for the draw_text function #122

Open
FeDorDrolma98 opened this issue Apr 10, 2024 · 0 comments
Open

More intuitive color use for the draw_text function #122

FeDorDrolma98 opened this issue Apr 10, 2024 · 0 comments

Comments

@FeDorDrolma98
Copy link

FeDorDrolma98 commented Apr 10, 2024

Hello,
The draw_text function currently use this formula to modify the color :
let mult = (1.0 - v).min(1.0); color::RGB((c1 * mult) as u8, (c2 * mult) as u8, (c3 * mult) as u8)

But when using it, it modify only the background of the glyph (which stay in black) :

Since it is more interesting to modify the color of the glyph itself, maybe this formula could be better (that's what I'm using) :
color::RGB((255.0+(c1-255.0)*v ) as u8, (255.0+(c2-255.0)*v ) as u8, (255.0+(c3-255.0)*v ) as u8)
If we want it to work we also have to modify this (not useful anymore to do '255 - components[_]' I guess):

        let c1 = f32::from(components[0]);
        let c2 = f32::from(components[1]);
        let c3 = f32::from(components[2]);

Then it is really the font that is changing color :

What do you think?

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

1 participant