SIGN IN SIGN UP

text_view: Add to support custom inline code style. (#2146)

## Summary

Adds an `inline_code: StyleRefinement` field to `TextViewStyle`, giving
consumers full style control over inline code spans (backtick text).
Follows the same pattern as the existing `code_block: StyleRefinement`
field.

## Problem

Inline code currently uses `cx.theme().accent` as its background
highlight. The accent color is designed for
interactive/attention-grabbing elements (buttons, links, selections),
which makes it visually heavy when applied to inline code mixed with
body text. There's no way to customize this without forking or vendoring
the crate.

## Solution

Add a new `StyleRefinement` field to `TextViewStyle` with a builder
method, matching `code_block`:

```rust
// In TextViewStyle:
pub inline_code: StyleRefinement,

// Builder:
pub fn inline_code(mut self, style: StyleRefinement) -> Self
```

**Default behavior is unchanged** — when the field is
`StyleRefinement::default()`, inline code continues to use
`cx.theme().accent` exactly as before. Consumers who want a different
background can set it:

```rust
let mut inline_style = StyleRefinement::default();
inline_style.text.background_color = Some(my_color);
let style = TextViewStyle::default().inline_code(inline_style);
```

## Implementation

Two files changed:

- **`crates/ui/src/text/style.rs`**: Added `inline_code:
StyleRefinement` field, `StyleRefinement::default()` default, and
builder method
- **`crates/ui/src/text/node.rs`**: In `Paragraph::render()`, reads
`node_cx.style.inline_code.text.background_color` with fallback to
`cx.theme().accent`

The render path uses `text.background_color` (not element-level
`background`) because inline code renders as a text-run highlight via
`HighlightStyle`, not a container div.

## Backwards Compatibility

Fully backwards compatible:
- New field defaults to `StyleRefinement::default()` → existing behavior
preserved
- No changes required for existing consumers
- API is consistent with `code_block` field

`cargo check` passes cleanly.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>
K
KlausUllrich committed
cac67ad2e4378c11a8f36c9dae1b53446c14b18f
Parent: 58a6dec
Committed by GitHub <noreply@github.com> on 8/10/2026, 10:52:09 AM