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

Enable changing font colors inline #1079

Closed
tongyliu opened this issue Jan 17, 2018 · 2 comments
Closed

Enable changing font colors inline #1079

tongyliu opened this issue Jan 17, 2018 · 2 comments

Comments

@tongyliu
Copy link
Contributor

tongyliu commented Jan 17, 2018

The Problem

Currently, in order to render differently colored text on a single line, a ColumnSet has to be used. While this mostly works, it makes the markup a little bit clunky, and in some cases also leads to text wrapping poorly:

capture

Asks

  • Bing

Potential Designs

Option 1:

Since Markdown syntax is already supported in TextBlocks, one option is to add support for some type of "Markdown-like" syntax for defining font colors.

{
    "type": "TextBlock",
    "text": "[color=good](The Huffington Post) · 5/23/2016",
    "wrap": true,
    "maxLines": 2
}

Option 2:

Alternatively, being able to create TextBlocks that display inline would also work. This option would likely be more difficult to implement with regard to handling wrap and maxLines parameters, though.

{
    "type": "TextBlock",
    "display": "inline",
    "color": "good",
    "text": "The Huffington Post",
    "wrap": true,
    "maxLines": 2
},
{
    "type": "TextBlock",
    "display": "inline",
    "text": " · 5/23/2016",
    "wrap": true,
    "maxLines": 2
}

Option 3

Mimick what XAML does with RichTextBlock...

{
  "type": "RichTextBlock",
  "wrap": true,
  "maxLines": 2,
  "paragraphs": [
    {
      "inlines": [
        {
          "type": "TextRun",
          "text": "The Huffington Post",
          "color": "good"
        },
        {
          "type": "TextRun",
          "text": "5/23/2016"
        }
      ]
    }
  ]
}

This could also be our solution for inline actions, #865, too, and inline advanced emojis #1645

@andrewleader
Copy link
Contributor

Proposal needs more review. General debate about markdown.

@andrewleader
Copy link
Contributor

Closing in favor of inline text runs to solve this: #1933

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants