Skip to content

feat: css_filter - #116

Open
ozwaldorf wants to merge 20 commits into
catppuccin:mainfrom
ozwaldorf:feat/css_filter
Open

feat: css_filter#116
ozwaldorf wants to merge 20 commits into
catppuccin:mainfrom
ozwaldorf:feat/css_filter

Conversation

@ozwaldorf

@ozwaldorf ozwaldorf commented Nov 24, 2025

Copy link
Copy Markdown

COBYLA CSS Filter generation

Ports an originally SPSA (Simultaneous Perturbation Stochastic Approximation) based algorithm to derive CSS filter properties that transform black (#000000) into a target color. This is useful for applying color transformations to SVG icons and other elements that cannot be colored with fill, using CSS filters instead.

References

Differences to reference implementations

  • We make an algorithmic change to COBYLA which produces more accurate results, does not rely on rng (faster), and for low parameters like this problem has fast convergence compared to SPSA
  • The loss function uses the Oklab perceptually uniform color space for more accurate color matching.
  • We use starting parameters tuned from the initial algorithms output for each accent color. This provides good distribution for a bunch of target hues and produces great results
  • Simd can be leveraged by the rust compiler vs JavaScript

Notes

  • Currently, the result is indeterminate across host systems (macos and windows will produce different results than x86_64 linux)
  • Results are deterministic for the catppuccin color palettes
  • It may also be beneficial to cache the results to disk

Example output

b

@ozwaldorf

ozwaldorf commented Nov 24, 2025

Copy link
Copy Markdown
Author

Currently, the algorithm does not produce identical results on all platforms, I suspect due to floating point and simd differences on each target. We may need to just have the end to end test just run the generation and not strictly check the output

@ozwaldorf
ozwaldorf marked this pull request as draft January 9, 2026 04:28
@ozwaldorf
ozwaldorf marked this pull request as ready for review January 27, 2026 00:02
WalkQuackBack added a commit to catppuccin/userstyles that referenced this pull request Jan 27, 2026
Updates the Catppuccin Filters in the standard library to use the COBYLA CSS filters in catppuccin/whiskers#116
WalkQuackBack added a commit to catppuccin/userstyles that referenced this pull request Jan 27, 2026
feat(lib/lib): COBYLA CSS filters

Updates the Catppuccin Filters in the standard library to use the COBYLA CSS filters in catppuccin/whiskers#116
benoit-planche pushed a commit to benoit-planche/userstyles that referenced this pull request Jan 30, 2026
feat(lib/lib): COBYLA CSS filters

Updates the Catppuccin Filters in the standard library to use the COBYLA CSS filters in catppuccin/whiskers#116
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.

1 participant