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

Make it possible for themes to blur backgrounds #20447

Merged
merged 6 commits into from
Apr 10, 2024

Conversation

Nezz
Copy link
Contributor

@Nezz Nezz commented Apr 6, 2024

Proposed change

Currently themes have little control over the backdrop-filter properties. The only one they can control is the whole screen when a dialog is open:

-webkit-backdrop-filter: var(--dialog-backdrop-filter, none);
backdrop-filter: var(--dialog-backdrop-filter, none);

This PR makes it possible for themes to control the backdrop-filter for cards and dialogs. This allows the use of blurred background among others. For example without and with a blur filter:

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

--ha-card-background: rgba(0, 0, 0, 0.1);
--ha-card-backdrop-filter: blur(20px);
--dialog-surface-backdrop-filter: blur(20px);

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@Nezz Nezz marked this pull request as ready for review April 6, 2024 16:03
@basnijholt
Copy link
Contributor

This would be a great addition and definitely worth it regarding the small change set!

Co-authored-by: Bram Kragten <[email protected]>
@Nezz
Copy link
Contributor Author

Nezz commented Apr 9, 2024

Should I update this to have the ha prefix too?

-webkit-backdrop-filter: var(--dialog-backdrop-filter, none);
backdrop-filter: var(--dialog-backdrop-filter, none);

That would be a breaking change though.

@bramkragten
Copy link
Member

bramkragten commented Apr 9, 2024

Should I update this to have the ha prefix too?

-webkit-backdrop-filter: var(--dialog-backdrop-filter, none);
backdrop-filter: var(--dialog-backdrop-filter, none);

That would be a breaking change though.

I think that one is a bit confusing now anyway, as we have multiple variables for the dialog now. Should be ha-dialog-scrim-backdrop-filter.

We can make the change non breaking though: backdrop-filter: var(--ha-dialog-scrim-backdrop-filter, --dialog-backdrop-filter);

@Nezz
Copy link
Contributor Author

Nezz commented Apr 9, 2024

Good point. Should it actually be this?

var(--ha-dialog-scrim-backdrop-filter, var(--dialog-backdrop-filter, none));

@bramkragten
Copy link
Member

Good point. Should it actually be this?

var(--ha-dialog-scrim-backdrop-filter, var(--dialog-backdrop-filter, none));

The default is none anyway, so not really needed but sure 👍

@bramkragten bramkragten merged commit bf176ac into home-assistant:dev Apr 10, 2024
13 checks passed
@Nezz Nezz deleted the patch-1 branch April 10, 2024 11:17
@@ -119,6 +125,8 @@ export class HaDialog extends DialogBase {
margin-top: var(--dialog-surface-margin-top);
min-height: var(--mdc-dialog-min-height, auto);
border-radius: var(--ha-dialog-border-radius, 28px);
-webkit--filter: var(--ha-dialog-surface--filter, none);
-filter: var(--ha-dialog-surface--filter, none);
Copy link

Choose a reason for hiding this comment

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

Shouldn't this be a single dash here: --ha-dialog-surface--filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I fixed this in my fork but for some reason not on this branch.

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.

4 participants