Skip to content

feat: add CSS3 filter support#11176

Closed
shaidshark wants to merge 2 commits intoNativeScript:mainfrom
shaidshark:feature/css-filter-support
Closed

feat: add CSS3 filter support#11176
shaidshark wants to merge 2 commits intoNativeScript:mainfrom
shaidshark:feature/css-filter-support

Conversation

@shaidshark
Copy link
Copy Markdown

@shaidshark shaidshark commented Apr 2, 2026

Fixes #1428

This PR adds CSS3 filter property support to NativeScript with parser coverage and native implementations for iOS and Android.

Included

  • parser support for CSS filter functions
  • native filter handling for iOS and Android
  • tests for filter parsing
  • follow-up type-safety cleanup for the implementation

Supported filters

  • blur
  • brightness
  • contrast
  • grayscale
  • saturate
  • invert
  • sepia
  • hue-rotate
  • drop-shadow
  • opacity

Platform limitations / notes

  • drop-shadow is not fully implemented on Android due to platform limitations
  • hue-rotate is not fully supported on Android and should be treated as a partial implementation
  • opacity overlaps conceptually with the existing opacity property and may need careful handling in edge cases

Context

This PR builds on the CSS filter support work and also addresses follow-up type-safety issues raised during review.

- Implement filter CSS property with support for:
  blur, brightness, contrast, grayscale, saturate,
  invert, sepia, hue-rotate, drop-shadow (iOS), and opacity.
- Added filter-parser.ts to parse filter functions.
- Added native implementations for iOS (CIFilter) and Android (RenderEffect/ColorMatrix).
- Added unit tests for filter parser.

Note: drop-shadow on Android not fully implemented due to platform limitations.
opacity filter function sets view alpha directly.

Fixes NativeScript#1428
@NathanWalker
Copy link
Copy Markdown
Contributor

Great effort @shaidshark, I know @triniwiz had some filters going here as well #11091, let's see if makes sense to combine them?

Copy link
Copy Markdown
Contributor

@CatchABus CatchABus left a comment

Choose a reason for hiding this comment

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

@shaidshark I believe the PR title has more room for improvement.
For start:

  • It's not a fix but a new feature so please follow the PR guidelines and use the proper prefix and title format
  • There's no need to mention all those details in title for a feature that is implemented now
  • The PR description is a bit confusing, feels as if it analyzes improvements on a current implementation

@CatchABus
Copy link
Copy Markdown
Contributor

CatchABus commented Apr 2, 2026

I see this is mentioned in your commits:

Note: drop-shadow on Android not fully implemented due to platform limitations.
opacity filter function sets view alpha directly.

This is also one important detailed that has to be mentioned in the PR details.

@shaidshark shaidshark changed the title Fix CSS3-filter-support: type safety improvements, hue-rotate warning, drop-shadow fallback comments feat: add CSS3 filter support Apr 2, 2026
@shaidshark
Copy link
Copy Markdown
Author

Thanks — good call on the title/description. I’ve updated the PR metadata so it’s clearly framed as a feature PR, and I added the platform limitations (especially Android drop-shadow and hue-rotate) to the description.

@shaidshark
Copy link
Copy Markdown
Author

Also noted on the overlap with #11091. I’m happy to align/merge direction with that work if it makes more sense than keeping the changes separate.

@shaidshark shaidshark closed this Apr 3, 2026
@shaidshark shaidshark deleted the feature/css-filter-support branch April 3, 2026 18:35
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.

CSS3 filter support [$300]

3 participants