# gpui: Add support for slash pattern fills \(\`///\`\) \(\#23576\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/23672987ff5af1c3946f369245a70631634cd114)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 23672987ff5af1c3946f369245a70631634cd114

Requested commit: 23672987ff5af1c3946f369245a70631634cd114

Commit: 23672987ff5af1c3946f369245a70631634cd114

Tree: 6832e96a7d40f6c911e891342f8bb17a8b34e06b

Author: Nate Butler

Committer: GitHub

## Message

````
gpui: Add support for slash pattern fills (`///`) (#23576)

TODO:
- [x] Add BackgroundTag::PatternSlash
- [x] Support metal slash pattern fills
- [x] Support blade slash pattern fills
---

Adds support for a new background type in gpui, `pattern_slash`.

Usage:

```rust
div().size(px(56.0)).bg(pattern_slash(gpui::red()))
```
This will create a 56px square with a red slash pattern fill.

You can run the pattern example with `cargo run -p gpui --example
pattern`:

![CleanShot 2025-01-23 at 16 22
09@2x](https://github.com/user-attachments/assets/39d9f8c8-816c-4d3b-bc75-fcc122747e17)

---

After talking with @as-cii at length about how we want to support
patterns in gpui, we decided for now we'll simply add a new
BackgroundTag specific to this pattern.

It isn't the best long term plan however – we'll likely want to
introduce the concept of a `Fill` at some point so we can have
`Fill::Solid`, `Fill::Gradient(LinearGradient)`, etc in the future.

The pattern is designed to seamlessly tile vertically for elements of
the same height. For example, for use in editor line backgrounds:

![CleanShot 2025-01-23 at 16 27
41@2x](https://github.com/user-attachments/assets/d51b94bc-cfc2-4aff-89e3-289a04ea8841)

---


Release Notes:

(do we do gpui release notes?)
- Adds support for slash pattern fills in `gpui`.

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
````

## Parents

- [070890d36111a5265fc2336180747bf33d1006f1](https://git.cafe/gitcafe/zed/commit/070890d36111a5265fc2336180747bf33d1006f1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/23672987ff5af1c3946f369245a70631634cd114?format=markdown)
