Skip to content

[DRAFT] Centralize Styling to allow for Themes#2109

Draft
Zoooombie wants to merge 5 commits into
PathOfBuildingCommunity:devfrom
Zoooombie:feature/themes
Draft

[DRAFT] Centralize Styling to allow for Themes#2109
Zoooombie wants to merge 5 commits into
PathOfBuildingCommunity:devfrom
Zoooombie:feature/themes

Conversation

@Zoooombie
Copy link
Copy Markdown

Fixes #535 (to some degree).

This is a draft because I have not done everything yet (I have not touched the calcs tab at all for example). Additionally some parts I could not figure out what they did, so I left them as is.
Open to feedback and help with understanding missing parts.

Description of the problem being solved:

Currently most colors and fonts are defined inline when drawing anything. This means color definitions are scattered across the code base making changing the theme of PoB a nightmare. I propose a CSS inspired approach where colors are defined in one central location with drawing logic referencing these through abstracted names (e.g. 'button_background' instead of #000000 in button definition). This way we can change what 'button_background' as a color means depending on the active theme.

To achieve this I made small wrappers for these functions to use style names (like 'button_background') instead of a color/font in Style.lua:

  • SetDrawColor() -> SetDrawStyle()
  • DrawString() -> StyledDrawString()
  • DrawStringWidth() -> StyledDrawStringWidth()
  • DrawStringCursorIndex() -> StyledDrawStringCursorIndex()

I made 2 seperate themes to demonstrate the change:

  • Classic, to stay as close to the previous look as possible
  • Dark, the way I personally like it (inspired by the poe2 trade site)

Note: I went through the draw calls and changed them by hand. I did not use AI for any changes to existing code.

After screenshots:

Here are some screenshots of the same views with both themes

Options
image
image

Configuration
image
image

Tree
image
image

Items
image
image

Calcs
image
image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the U.I.

1 participant