Skip to content

CSS: Improve browser compatibility by replacing from ... r g b syntax#11939

Merged
danielchalmers merged 4 commits intoMudBlazor:devfrom
danielchalmers:css-from-workaround
Oct 7, 2025
Merged

CSS: Improve browser compatibility by replacing from ... r g b syntax#11939
danielchalmers merged 4 commits intoMudBlazor:devfrom
danielchalmers:css-from-workaround

Conversation

@danielchalmers
Copy link
Member

@danielchalmers danielchalmers commented Oct 6, 2025

CSS: Use pre-computed values instead of from ... r g b syntax on border colors
Fixes #11936 by using an older syntax that is more widely supported.

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the style of this project.
  • I've added relevant tests or confirmed existing ones.

@danielchalmers danielchalmers requested a review from Copilot October 6, 2025 23:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes browser compatibility issues by replacing the CSS rgb(from var(...) r g b / alpha) syntax with the more widely supported rgba() syntax, addressing issue #11936.

Key changes:

  • Replace all rgb(from var(--color) r g b / opacity) with rgba(var(--color-rgb), opacity)
  • Add corresponding -rgb CSS custom properties to the theme provider for color values in RGB format
  • Update test files to reflect the new CSS custom properties

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
_togglegroup.scss Updated border-color properties to use rgba syntax
_chip.scss Updated border property to use rgba syntax
_buttongroup.scss Updated multiple border properties to use rgba syntax
_button.scss Updated border properties in outlined button styles to use rgba syntax
_avatar.scss Updated border properties in outlined avatar styles to use rgba syntax
_alert.scss Updated border properties in outlined alert styles to use rgba syntax
MudThemeProvider.razor.cs Added generation of RGB format CSS custom properties for text and divider colors
ThemeProviderTests.cs Updated test assertions to include new RGB format CSS properties
Test razor files Updated background-color properties in test components to use rgba syntax
Dialog example Updated background properties to use rgba syntax

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a good initiative to improve browser compatibility by replacing the rgb(from ...) CSS syntax with the more widely supported rgba(...) syntax. This is achieved by introducing new CSS variables with an -rgb suffix. The changes are applied consistently across the codebase.

I've found one critical issue where a new CSS variable is used but not generated, which will break styling in one of the examples. I've also noticed a minor file encoding issue in two test files where a BOM character was introduced. My review includes suggestions to fix these points.

@danielchalmers danielchalmers changed the title CSS: Use pre-computed values instead of from r g b syntax CSS: Use pre-computed values instead of from ... r g b syntax Oct 6, 2025
@danielchalmers danielchalmers changed the title CSS: Use pre-computed values instead of from ... r g b syntax CSS: Use pre-computed values instead of from ... r g b syntax on border colors Oct 6, 2025
@danielchalmers danielchalmers changed the title CSS: Use pre-computed values instead of from ... r g b syntax on border colors CSS: Improve browser support of border color opacity Oct 6, 2025
@danielchalmers danielchalmers changed the title CSS: Improve browser support of border color opacity CSS: Improve browser compatibility by removing from ... r g b syntax Oct 6, 2025
@danielchalmers danielchalmers changed the title CSS: Improve browser compatibility by removing from ... r g b syntax CSS: Improve browser compatibility by replacing from ... r g b syntax Oct 7, 2025
@danielchalmers danielchalmers merged commit 2800282 into MudBlazor:dev Oct 7, 2025
6 checks passed
@danielchalmers danielchalmers deleted the css-from-workaround branch October 7, 2025 00:03
@danielchalmers danielchalmers added bug Unexpected behavior or functionality not working as intended regression Previously worked and now doesn't labels Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended regression Previously worked and now doesn't

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudButton Variant.Outlined no outline on Android (MAUI Hybrid)

2 participants