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

UI: Theme extensions #4398

Merged
merged 3 commits into from Dec 14, 2022
Merged

Conversation

dennisreimann
Copy link
Member

Adds the ability to choose the themeing strategy: Extend one of the existing themes (light or dark) or go fully custom. The latter was the only option up to now, which isn't ideal:

  • One had to provide a full-blown theme file overriding all variables
  • Tedious, error prone and hard to maintain, because one has to keep track of updates

This PR makes it so that one can choose light or dark as base theme and do modifications on top.

Benefit: You can specify a limited set of variables and might get away with 5-20 lines of CSS.

Example: This is what the CSS theme for Einundzwanzig could look like:

:root {
  --btcpay-primary-100: #fef3e6;
  --btcpay-primary-200: #fcdcb5;
  --btcpay-primary-300: #fbc584;
  --btcpay-primary-400: #f9ae53;
  --btcpay-primary-500: #f79621;
  --btcpay-primary-600: #de7d08;
  --btcpay-primary-700: #ac6106;
  --btcpay-primary-800: #7b4504;
  --btcpay-primary-900: #4a2a03;

  --btcpay-primary-rgb: 247,150,33;
  --btcpay-primary: rgb(var(--btcpay-primary-rgb));
  --btcpay-primary-accent: var(--btcpay-primary-600);
  --btcpay-primary-shadow: rgba(var(--btcpay-primary-rgb), .5);
}

This is the implementation for themeing on the server/instance level — a similar and maybe even more reduced approach could be used for the stores as well. I'll tackle that once we get to unify the public store-related pages with the new checkout design.

In Action

theme

Backwards-compatibility

The default option is "fully custom", which makes it work with the CustomThemeCssUri which might be specified already. If that property is set, we also don't show the CSS file upload, because those would conflict.

The idea here is that we can deprecate the old way of themeing by presenting the new one in case the old approach isn't used (anymore).

@dennisreimann dennisreimann added UI / UX Front-end issues, for front-end designers Server Settings Enhancement Improvements to an existing feature labels Dec 3, 2022
@dstrukt
Copy link
Member

dstrukt commented Dec 4, 2022

Still testing and exploring...

In order to upload a theme file, a [file storage] must be configured. to confirm, this will disappear when #4386 is merged, yeah?

Chose the fully custom (which is the default .. wondering if it should default to the extension of the current selected theme, if this is possible, as if you go full custom, but don't upload anything you're met with this .. which isn't ideal, but I'm thinking we should probably handle this case a little better, but not 100% certain what the best route would be...
Screen Shot 2022-12-04 at 3 51 46 PM

@dennisreimann
Copy link
Member Author

@dstrukt good point, updated it to ensure a custom theme is present, otherwise it'll fall back to the server theme.

to confirm, this will disappear when #4386 is merged, yeah?

Exactly!

Adds the ability to choose the themeing strategy: Extend one of the existing themes (light or dark) or go fully custom. The latter was the only option up to now, which isn't ideal:

- One had to provide a full-blown theme file overriding all variables
- Tedious, error prone and hard to maintain, because one has to keep track of updates

This PR makes it so that one can choose light or dark as base theme and do modifications on top.

Benefit: You can specify a limited set of variables and might get away with 5-20 lines of CSS.
@NicolasDorier NicolasDorier merged commit 6972e8a into btcpayserver:master Dec 14, 2022
@dennisreimann dennisreimann deleted the theme-settings branch December 14, 2022 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvements to an existing feature Server Settings UI / UX Front-end issues, for front-end designers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants