Skip to content

POC: Theme Singleton for color definitions and UI toggling #109

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

Closed
wants to merge 17 commits into from

Conversation

jarolrod
Copy link
Member

@jarolrod jarolrod commented Jan 6, 2022

based on #101, #102, #106
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. Adds a ThemeToggleButton so that we can toggle between light and dark. Uses the moon and sun icon from BitcoinIcons.

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

Current views are:
light-toggle

dark-toggle

Windows
macOS
Android

To accomplish a proper demo of these components we first place our forms
(ConnectionOptions and ConnectionSettings) into a StackLayout.
The ContinueButton is then made to advance/rewind the stack.
A PageIndicator is added to highlight the functionality of the demo.
This simplifies the OptionButton control.
To achieve a proper demo, the component is added to our StackLayout.
Now that there are several components, introduce a toolbar with a
textButton "< Back" that allows for rewinding the stack.
Represents the individual views for the onboarding wizard.
This demonstrates the visual aspect of the onboarding wizard.
The stub page is given a StackView with the onboarding wizard
as it's initial item. When the oboarding wizard is finished,
the StackView is given a node component which starts node
initialization and displays the current block count.
Holds color definitions and updates based on if in dark mode.
These icons are to be used in a button that toggles the UI theme.
Toggles the UI between light and dark mode.
@GBKS
Copy link
Contributor

GBKS commented Jan 11, 2022

Concept ACK (others can better evaluate the technical implementation).

Can we use a similar Singleton approach for other variables (spacing, text styles, etc)?

@promag
Copy link
Contributor

promag commented Jan 11, 2022

@GBKS yes, like color, it can have more properties.

@jarolrod jarolrod marked this pull request as draft February 6, 2022 09:30
@jarolrod
Copy link
Member Author

jarolrod commented Apr 6, 2022

Replaced by #114

@jarolrod jarolrod closed this Apr 6, 2022
hebasto added a commit that referenced this pull request May 25, 2022
9b9d198 qml: update UI elements to use Theme color definitions (jarolrod)
e0225a0 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 9b9d198

Tree-SHA512: 9d98d887d3254dbb8066e484a17fa3950a728e15ee8d70d372e5f883e3e0080031f04a66f00c65348ce0b90377d08a9db30a98edfdc40cd06b147d74f77cd8cb
@jarolrod jarolrod deleted the styling-and-toggle branch August 21, 2022 19:52
hebasto added a commit that referenced this pull request Aug 29, 2022
6e0ee80 qml: reduce usage of ternaries in Theme file (Jarol Rodriguez)

Pull request description:

  Reduces usage of ternaries in Theme.qml by abstracting definitions of colors and image urls into "Sets" and using the definitions from the appropriate set for the current dark mode setting.

  This is a late follow-up to this review by **promag**: #109 (comment)

  [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/168)
  [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/168)
  [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/168)
  [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/168)

ACKs for top commit:
  hebasto:
    ACK 6e0ee80, I have reviewed the code and it looks OK, I agree it can be merged.

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

3 participants