canselcik / libremarkable

The only public framework for developing applications with native refresh support for Remarkable Tablet
MIT License
616 stars 56 forks source link

More intuitive color use for the draw_text function #122

Closed FeDorDrolma98 closed 3 months ago

FeDorDrolma98 commented 6 months ago

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?

andrewjensen commented 4 months ago

I would love having independent color_foreground and color_background arguments. That would allow for more faded text like the screenshot above as well as text on darker panels.