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

Support background color for a range of text #22

Closed
ghost opened this issue Mar 15, 2014 · 4 comments
Closed

Support background color for a range of text #22

ghost opened this issue Mar 15, 2014 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 15, 2014

Hi Tomas,
I am in the process of implementing a highlighting method.
I am doing this simple code. I verified all values, they are all fine.

tempStype = "-fx-background-color: yellow;" ;
indexRange =richText.getSelection();
richText.setStyle(indexRange.getStart(), indexRange.getEnd(), tempStyle);

I notice a change in the range style, but the background is not affected. Is it broken? Can you verify?

@TomasMikula
Copy link
Member

Hi Maher,

this is currently not supported. Whatever style you assign to a range ends up being applied to a Text node. Text node itself does not support background color. I suppose it would be possible to extend Text to support this, but I would have to research it more thoroughly.

@ghost
Copy link
Author

ghost commented Mar 15, 2014

Hi Tomas, As an alternative, I will use the "-fx-strikethrough: true" "-fx-strikethroug: false" to highlight ranges in a way that does change their appearance much. I am trying to avoid changing other parameters.

@TomasMikula
Copy link
Member

Hi Maher,

maybe you will prefer the dropshadow effect:

-fx-effect: dropshadow(gaussian, yellow, 3, 1, 0, 0);

@TomasMikula
Copy link
Member

This is now resolved by #166 thanks to @MewesK. The name of the property is -fx-background-fill.

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

1 participant