Text Color In Dark Background

Hey there.
I am trying to make a login UI for something I am making I would like the login/sign up buttons to be dark background, light text.
This is my code:

function loginUISetup()
    gfx.setLineWidth(4)
    gfx.drawText("*wasteof.money*", 10, 5)
    gfx.drawText("Username ⬅️", 25, 45)
    gfx.drawRoundRect(25, 70, 350, 40, 5)
    gfx.drawText("Password ➡️", 25, 125)
    gfx.drawRoundRect(25, 150, 350, 40, 5)
    gfx.drawRoundRect(25, 205, 170, 30, 5)
    gfx.drawRoundRect(205, 205, 170, 30, 5)
    gfx.setColor(gfx.kColorBlack)
    gfx.fillRect(25, 205, 170, 30)
    gfx.fillRect(205, 205, 170, 30)
    gfx.setColor(gfx.kColorWhite)
    gfx.drawText("*Sign Up* Ⓐ", 75, 212)
    gfx.drawText('*Login* Ⓑ', 255, 212)
end

Is there something I am doing wrong, or can you not do what I am trying?
playdate-20220830-150910

Fonts are images, so you need to use

https://sdk.play.date/inside-playdate/#f-graphics.setImageDrawMode

...not setColor. Yes, it's a little unexpected. :sweat_smile:

Works now!
playdate-20220830-152422

2 Likes

Very understandable mistake. I recommend reading the inside playdate documentation top to bottom. You'll learn the things you didn't know you wanted to know

1 Like