Skip to content

Introduce and use Theme singleton#114

Merged
hebasto merged 2 commits into
bitcoin-core:mainfrom
jarolrod:theme-singleton
May 25, 2022
Merged

Introduce and use Theme singleton#114
hebasto merged 2 commits into
bitcoin-core:mainfrom
jarolrod:theme-singleton

Conversation

@jarolrod
Copy link
Copy Markdown
Contributor

@jarolrod jarolrod commented Apr 6, 2022

Replaces #109

This introduces a Theme singleton which contains color definitions so that colors can be used by name instead of by hex. Additionally, it adjusts color definitions depending on if the gui is in dark or light mode.

Color definitions are based on our color palettes as defined in our design system:
color-definitions

A convenient demo of the changes can be found here: theme singleton demo

This demo adds a ThemeToggleButton so that we can toggle between light and dark. Uses the moon and sun icon from BitcoinIcons.

Copy link
Copy Markdown
Contributor

@shaavan shaavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

  • The Theme.qml file and qmldir file are introduced correctly.

I was able to find some corrections that will help improve this PR.

Places where Theme singleton could be used:

  • In ContinueButton.qml file. color: "white"
  • In OptionSwitch.qml file. color: "#ffffff"

If I am mistaken, and the above colors should remain unchanged with dark mode toggling, I would suggest adding a non-changing white color variant in Theme.qml file as well and using it.

Comment thread src/qml/controls/Theme.qml Outdated
@GBKS
Copy link
Copy Markdown
Contributor

GBKS commented Apr 7, 2022

Agree with @shaavan's suggestion. There are just a couple of places where I think we want to have a consistent color across both themes, the inactive toggle state being one of them.

I updated the Figma file with a "Static white" color and applied to the toggle. Let me know if you see other places to update this, and other colors to add.

@jarolrod jarolrod force-pushed the theme-singleton branch 3 times, most recently from 581961a to 44a7696 Compare April 10, 2022 17:51
@jarolrod
Copy link
Copy Markdown
Contributor Author

Updated from (pr114.01 -> pr114.02, compare) to address review feedback. Then, updated from 7698dca to 581961a (pr114.02 -> pr114.03, compare) to fix trailing whitespace, or so I thought I had fixed it. Finally, updated from 581961a to 44a7696 (pr114.03 -> pr114.04, compare) to finally fix the linter.

The main diff to review is between pr114.01 and pr114.02

Changes: incorporate review feedback from @shaavan and @GBKS

  • Address two instances where components were not using the theme definitions
  • The color definitions were in fact flipped. Addressed the flipped definitions and adjusted the colors called by controls/components to fit inline with the specifications of the main design file.
  • Introduced a white color definition to work as a static white color. This is to be used in places where the color white should not switch as it does with the definition of the color neutral0.

Additionally, the demo has been updated in order to display all components that we have which in turn incorporate all of the controls we have. This allows for convenient testing that the color definitions are as they should be. The demo can be found here: theme singleton demo

Copy link
Copy Markdown
Contributor

@shaavan shaavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes since my last review:

  • Ordering of neutral0 - neutral9 is fixed.
  • Added a static white color to the theme file and used it in the qml directory.

The arrangement of neutral0 - neutral9 is toggled and is now in line with the design system file.

I was able to verify that this PR is correctly formatted according to the clang format.

There is, however, one thing that needs to be addressed.

Comment thread src/qml/controls/Theme.qml Outdated
jarolrod added 2 commits May 11, 2022 01:21
Holds color definitions and updates based on if in dark mode.
@jarolrod
Copy link
Copy Markdown
Contributor Author

updated from 44a7696 to 9b9d198 (pr114.04 -> pr114.05, compare)

Changes: addressed @shaavan comments. Thank you for the eagle-eye review

Copy link
Copy Markdown
Contributor

@shaavan shaavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 9b9d198

Changes since my last review:

  • The color values for the dark and light themes for blue and purple have been fixed.

I successfully ran the theme singleton demo. I am attaching a few screenshots to show the correct working of this PR.

Screenshots:

1 2
Light Theme Light1 Light2
Dark Theme Dark1 Dark2

@hebasto hebasto merged commit 98280cb into bitcoin-core:main May 25, 2022
@jarolrod jarolrod deleted the theme-singleton branch August 21, 2022 19:49
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 7, 2025
Holds color definitions and updates based on if in dark mode.

Github-Pull: bitcoin-core#114
Rebased-From: e0225a0
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 7, 2025
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 8, 2025
Holds color definitions and updates based on if in dark mode.

Github-Pull: bitcoin-core#114
Rebased-From: e0225a0
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 8, 2025
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 8, 2025
Holds color definitions and updates based on if in dark mode.

Github-Pull: bitcoin-core#114
Rebased-From: e0225a0
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 8, 2025
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
Holds color definitions and updates based on if in dark mode.

Github-Pull: bitcoin-core#114
Rebased-From: e0225a0
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
Holds color definitions and updates based on if in dark mode.

Github-Pull: bitcoin-core#114
Rebased-From: e0225a0
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
johnny9 pushed a commit to johnny9/bitcoin-core-app that referenced this pull request Jul 4, 2025
07fa49e qml: update UI elements to use Theme color definitions (jarolrod)
57dcd4f qml: introduce Theme singleton (jarolrod)

Pull request description:

  Replaces #109

  This introduces a `Theme` singleton which contains color definitions so that colors can be used by name instead of by hex. Additionally, it adjusts color definitions depending on if the gui is in dark or light mode.

  Color definitions are based on our color palettes as defined in our [design system](https://www.figma.com/file/GaCoOSNHB2yMB9ThiDtred/Bitcoin-Core-App-Main?node-id=2643%3A83514):
  ![color-definitions](https://user-images.githubusercontent.com/23396902/148453667-bdaa347f-b4e9-4db9-9a82-027a10dc9e05.png)

  A convenient demo of the changes can be found here: [theme singleton demo](https://github.com/jarolrod/gui-qml/tree/theme-singleton-demo)

  This demo adds a `ThemeToggleButton` so that we can toggle between light and dark. Uses the `moon` and `sun` icon from [BitcoinIcons](https://github.com/BitcoinDesign/Bitcoin-Icons).

ACKs for top commit:
  shaavan:
    ACK 07fa49e

Tree-SHA512: 9d98d887d3254dbb8066e484a17fa3950a728e15ee8d70d372e5f883e3e0080031f04a66f00c65348ce0b90377d08a9db30a98edfdc40cd06b147d74f77cd8cb
tx-signer450 added a commit to tx-signer450/gui-qml that referenced this pull request Oct 20, 2025
07fa49e8d0d80d8c5a50767a6ea258be159d7eef qml: update UI elements to use Theme color definitions (jarolrod)
57dcd4f888a6259d030ca43280165ade4f83eb70 qml: introduce Theme singleton (jarolrod)

Pull request description:

  Replaces #109

  This introduces a `Theme` singleton which contains color definitions so that colors can be used by name instead of by hex. Additionally, it adjusts color definitions depending on if the gui is in dark or light mode.

  Color definitions are based on our color palettes as defined in our [design system](https://www.figma.com/file/GaCoOSNHB2yMB9ThiDtred/Bitcoin-Core-App-Main?node-id=2643%3A83514):
  ![color-definitions](https://user-images.githubusercontent.com/23396902/148453667-bdaa347f-b4e9-4db9-9a82-027a10dc9e05.png)

  A convenient demo of the changes can be found here: [theme singleton demo](https://github.com/jarolrod/gui-qml/tree/theme-singleton-demo)

  This demo adds a `ThemeToggleButton` so that we can toggle between light and dark. Uses the `moon` and `sun` icon from [BitcoinIcons](https://github.com/BitcoinDesign/Bitcoin-Icons).

ACKs for top commit:
  shaavan:
    ACK 07fa49e8d0d80d8c5a50767a6ea258be159d7eef

Tree-SHA512: 9d98d887d3254dbb8066e484a17fa3950a728e15ee8d70d372e5f883e3e0080031f04a66f00c65348ce0b90377d08a9db30a98edfdc40cd06b147d74f77cd8cb
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.

4 participants