Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add background styling to span / rich text #2516

Merged
merged 7 commits into from
Jul 28, 2024

Conversation

tarkah
Copy link
Member

@tarkah tarkah commented Jul 23, 2024

Adds a new text::Background type which can be optionally specified on Span.

rich_text will use this to render background quads for spans where this is set.

A new Paragraph::span_bounds method is added to get the bounds of each span to enabled this.

simplescreenrecorder-2024-07-23_13.37.52.mp4

I'm using this in Halloy:

image

@tarkah tarkah force-pushed the feat/span-background branch 4 times, most recently from 1feb29a to f70edc2 Compare July 24, 2024 00:01
core/src/text.rs Outdated Show resolved Hide resolved
Copy link
Member

@derezzedex derezzedex left a comment

Choose a reason for hiding this comment

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

I think we could improve the creation of the text::Background with a few helpers, and also possibly changing it to span::Background.
But looks pretty good overall!

graphics/src/text/paragraph.rs Outdated Show resolved Hide resolved
graphics/src/text/paragraph.rs Outdated Show resolved Hide resolved
widget/src/markdown.rs Outdated Show resolved Hide resolved
core/src/text.rs Outdated Show resolved Hide resolved
core/src/text.rs Outdated Show resolved Hide resolved
@hecrj hecrj added this to the 0.13 milestone Jul 27, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

I simplified some stuff here and there, but looks great! 🥳

@hecrj hecrj merged commit c47a6ed into iced-rs:master Jul 28, 2024
12 checks passed
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.

4 participants