X Tutup
Skip to content

Implement a consistent (and purple!) UI theme#5865

Merged
sturnclaw merged 16 commits intopioneerspacesim:masterfrom
sturnclaw:ui-theme-purple
Aug 21, 2024
Merged

Implement a consistent (and purple!) UI theme#5865
sturnclaw merged 16 commits intopioneerspacesim:masterfrom
sturnclaw:ui-theme-purple

Conversation

@sturnclaw
Copy link
Member

@sturnclaw sturnclaw commented Jul 15, 2024

After much frustration with the inconsistent colors of our existing theme (and the go-ahead from our resident UI designer @bszlrd), I've unified the theme colors used in the game's interface to a consistent UI style.

There are two major changes made by this PR:

  1. We now have a single primary "action color" used for most interactable elements in the UI, split up into various luminance-based breakpoints to ensure that UI elements are accessible even to colorblind users. The "accent" color is now used very sparingly where needed to highlight important text elements, alongside other semantic colors like success/warning/danger.
  2. Almost all window backgrounds are now a dark gray with subtle hints of purple. This provides a much more consistent feel to the UI than the prior bright purple/blue backgrounds did, allows us to use the blue accent color with less worry about colorblind users, and provides better text contrast - allowing us to reduce the sometimes absurdly large font sizes while still maintaining legibility.

Here's a quick clickthrough of the UI with the new theme:

2024-07-15.03-03-11.mp4

(Music: Stellardrone - To The Great Beyond)

There are still a few TODOs before this should be merged:

  • Better differentiate available and unavailable BBS ads (e.g. highlight/selection color)
  • Fix hardcoded colors in the C++ radial menu widget
  • Improve the color used in checkmarks to be less washed-out
  • Rewrite icon button widget to not render an overlay on top

@impaktor
Copy link
Member

Better differentiate available and unavailable BBS ads (e.g. highlight/selection color)

Out of scope / off topic, but this makes me think of how this was introduced in #2675. There was basically a disagreement in how it should work.

  • Should an advert be grayed out only after player had clicked it and been refused?
  • Or should all be grayed out right away, as if player had interacted with the advert all ready and knew the answer
  • Or grayed out could just mean "clicked: yes/no", like URLs on this interweb I keep hearing about.

I'm more biased to the first option, but second option (current master) is no doubt easier for the player.

@impaktor
Copy link
Member

@bszlrd video could go on youtube. (I wonder if we should distinguish between videos of unmerged stuff "IN DEVELOPMENT: <title> ", and actual merged stuff that can just have normal title?)

@bszlrd
Copy link
Contributor

bszlrd commented Jul 15, 2024

Looking good!

@sturnclaw
Copy link
Member Author

This branch is now ready for testing - I've done a pass on all icon buttons (and changed their size in some cases) as well as incorporated the latest icons.svg updates from @bszlrd. I'd appreciate a fairly close look at the entirety of the UI to catch edge cases / broken behaviors (i.e. buttons not working, broken text, scrollbars that weren't there before).

- ui.invisibleButton exposes the underlying ImGui::InvisibleButton functionality
- ui.getButtonColor selects the proper entry from a button color variant table according to the given state flags (useful when implementing a custom button-like widget)
- Allow using ui.invisibleButton with e.g. PressedOnClick or PressedOnDoubleClick
- Remove bright purple/blue backgrounds from all UI screens, replace with dark gray
- Normalize all UI elements to use "Pioneer Purple" rather than the various shades of blue from ImGui
- Change font color to a very light gray for less eyestrain against the dark background
- Fix some issues with semantic names being used to style items that have no relation to the semantic
- Remove direct usages of the styleColors objects; colors should go through the semantic aliases instead
Amend accent and danger colors:
- Improve consistency of color breakpoints
- Reduce oversaturated / overbright accent colors
- Better distribution of reds for danger color
- Add generic semantic color names based partially on Material Design.

Add alternate primary colors for foreground elements:
- Used for items like checkmarks and slider grabs
- Can also be used for text if needed

Use color variant objects for item cards rather than individual colors.
- Use existing popup / button colors to render radial menu widget
- Remove hardcoded colors in C++
- Responsible for drawing glyph-based icon buttons
- Effectively the same as a regular ImGui::Button(), but takes a separate display string and ID string
- Instead of passing in the size of the icon glyph and the size of the padding, all icon button widgets now take the total size of the button
- The size of the icon drawn on the button is computed from an explicit or implicit padding value
- Pass explicit id parameter rather than appending to tooltip
- Use full size of button rather than computing icon size + padding
- Use new increase_1 / decrease_1 icon names rather than time buttons
- Add filesystem related icons
- Add increase/decrease/reset icons
- Add plus / minus / close icons

ui: deduplicate icons in icon sheet

- Normalize icon usage to the first time defined, free up duplicate icon slots for future icons
- Deprecate use of retrograde icon as general-purpose close/delete icon
- Replace current_line icon with actual minus icon
- Replace large square "plus" with actual plus icon
@sturnclaw
Copy link
Member Author

I have one final TODO item to address, and then I'd like to start looking at merging this PR. Anyone willing to click around the UI and look out for bugs would be much appreciated.

@impaktor
Copy link
Member

I gave this a spin, below are just the thoughts that popped into my mind when I clicked through it.

  • I did get a crash when clicking on F3->equipment tab, (when starting a new game), but have not been able to reproduce now

  • Font size of Language table (when accessed in game ESC -> Languages) is very large compared to other tabs
    2024-08-17-082314_857x566_scrot_

  • Blue box in upper left for name & rank intentional? Thought I could click it / interact with it.
    2024-08-17-080609_981x664_scrot_

  • Magnification in ship spinner changed for ship market? good/bad?
    2024-08-17-081558_1264x624_scrot_

  • This is probably a critique against myself, as I'm the one who did this screen for NewUI->Pigui, but it's a bit unclear what that 8t belongs to, if it's for the bar to the left, or if it's in a table on it's own, independent of the left hand side. Perhaps a vertical line separating the two panes? Just a thought.
    2024-08-17-081246_1273x620_scrot_

@impaktor
Copy link
Member

Font size of Language table (when accessed in game ESC -> Languages) is very large compared to other tabs

Come to think of it, the "Language (restart game to apply)" line has always looked like it's part of the table list. Perhaps this should be blue, if possible?

@sturnclaw
Copy link
Member Author

Font size of Language table (when accessed in game ESC -> Languages) is very large compared to other tabs

Existing issue. That screen needs to be re-worked though and should be quick to do.

Blue box in upper left for name & rank intentional? Thought I could click it / interact with it.

Yes, the box indicates this is the selected crew member - the menu supports multiple crew members in a starting preset. It's already interactable, just doesn't render a hover effect.

Magnification in ship spinner changed for ship market? good/bad?

Default magnification is exactly the same. You've scrolled in on the ship spinner and zoomed in on the ship. Existing issue.

This is probably a critique against myself, as I'm the one who did this screen for NewUI->Pigui, but it's a bit unclear what that 8t belongs to, if it's for the bar to the left, or if it's in a table on it's own, independent of the left hand side. Perhaps a vertical line separating the two panes? Just a thought.

Also an existing issue! 😄

I'll try to address problems 1 and 4 if I can. The other two are non-issues or out-of-scope as far as I see it.

Come to think of it, the "Language (restart game to apply)" line has always looked like it's part of the table list. Perhaps this should be blue, if possible?

Will try to address this as well.

- Allows configuring the background color rendered under table rows for highlight or selection management
- Our ImGui version does not (yet) provide a way to query if the current table row is hovered to draw a highlight on hover. Will be a candidate for future inclusion or a custom function peeking into ImGui internals.
- Render a dark grey background on inactive BBS entries instead of purple; better communicates that those entries are not available to the player at this time.
- When the game is paused, dim the entire list of BBS entries and draw an indicator over the list.
- Helper to use the ImGui internal horizontal layout mode (used in menu bars)
- Implicitly calls ui.sameLine() after every submitted item
- ui.separator draws a vertical separator line when submitted within a horizontal group
- Add vertical separator to Economy / Cargo info-view tab
- Adjust scroll area and font size to language selection
@sturnclaw
Copy link
Member Author

All TODOs and review feedback addressed. Going to merge this PR as I'm satisfied it's had an appropriate amount of testing and is quite large already. Ignoring the SVG changes, this PR is +840 insertions, -470 deletions.

@sturnclaw sturnclaw merged commit 477e88b into pioneerspacesim:master Aug 21, 2024
@sturnclaw sturnclaw deleted the ui-theme-purple branch August 22, 2024 21:37
@impaktor
Copy link
Member

Post-merge thought: there's no difference in blue tone between selected tab and other/not-selected. I wonder if it might be of value to crank up the highlight of the selected tab? Or we only want it highlighted when mouse-over?
2024-08-23-100022_448x186_scrot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup