mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #1042] Form Input and Checkbox Colors Not Changing in tview Form #755
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#755
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @0xJWLabs on GitHub (Oct 20, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1042
Description
In my application using tview, I've created a login form with input fields for email, password, an optional code, and a checkbox. I am trying to set the background and text colors for these elements, but they don't seem to change, even though the code is correctly detecting the form items.
Code Snippet
Here's a snippet of the relevant part of the code:
Expected Behavior
Checkbox should change to a black background with red text.
Actual Behavior
@jsumners-nr commented on GitHub (Oct 23, 2024):
Have you tried using https://pkg.go.dev/github.com/rivo/tview#InputField.SetFieldStyle? It should look something like:
@rivo commented on GitHub (Nov 2, 2024):
The documentation for
AddFormItem()explains this:You'll want to use
Form.SetFieldBackgroundColor()andForm.SetFieldTextColor(), or, even better, the newForm.SetFieldStyle()function if you want to change the appearance of the form elements.