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

TableRow: Current color for selected row is not clear enough for dark theme #415

Closed
aj3423 opened this issue Nov 26, 2021 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@aj3423
Copy link

aj3423 commented Nov 26, 2021

Related problem

For dark theme, it's hard to see which row is selected, the selected color is very close to the non-selected.
image

I tried to modify giu.StyleColorTableRowBg but not work:

var sel = -1

func loop() {
	// this doesn't work
	giu.PushStyleColor(giu.StyleColorTableRowBg, color.RGBA{0x00, 0xff, 0xff, 0xff})
	defer giu.PopStyleColor()

	columns := []*giu.TableColumnWidget{
		giu.TableColumn("Col1"),
	}

	rows := []*giu.TableRowWidget{}
	for i := 0; i < 5; i++ {
		row := i
		rows = append(rows, giu.TableRow(
			giu.Selectable("64d782d6e7000ba9f85a37f382cee83b").
				Selected(sel == row).
				Flags(giu.SelectableFlagsSpanAllColumns).
				OnClick(func() { sel = row }),
		))
	}

	giu.SingleWindow().Layout(
		giu.Table().Columns(columns...).Rows(rows...),
	)

}

func main() {
	wnd := giu.NewMasterWindow("", 400, 200, 0)
	wnd.Run(loop)
}

Your request

  1. Use a better row selected color for dark theme.
  2. How to temporary change the color for selected row?

Alternative solution

Is it possible to add api to customize theme, or import directly from imgui theme thread ?

Additional context

No response

@aj3423 aj3423 added the enhancement New feature or request label Nov 26, 2021
@AllenDang
Copy link
Owner

@aj3423 The bg color you need to change is not table row, but selectable. You could find out which color enum works for what UI element by runing examples/imguidemo.go, and open Style Editor from Tools menu.

For your case, the color enums are HeaderHovered and HeaderActive.

And to create custome theme, you can refer the code of MasterWindow.

@aj3423
Copy link
Author

aj3423 commented Nov 26, 2021

@AllenDang Thanks, that demo helps. The giu.PushStyleColor(giu.StyleColorHeader, color.RGBA...) does the trick.

@aj3423 aj3423 closed this as completed Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants