react-highlight icon indicating copy to clipboard operation
react-highlight copied to clipboard

Different highlight background for different ranges

Open 132lilinwei opened this issue 4 years ago • 5 comments

Hi, Instead of using the highlightStyle prop for all ranges, can I pass a property for each range indicating their background colour?

132lilinwei avatar May 19 '20 15:05 132lilinwei

Hey!

Thanks for your message, do passing a function instead of an object for highlightStyle (with the range as argument) can solve your use case? If so I can make a change in the code to do so.

Let me know Yann

ydeshayes avatar May 24 '20 13:05 ydeshayes

@132lilinwei up?

ydeshayes avatar Jun 06 '20 12:06 ydeshayes

@ydeshayes Hey this is a brilliant project! Why don't you keep updating it?

shenlin192 avatar Oct 29 '20 21:10 shenlin192

@ydeshayes should solve our problem, can you update the lib, make highlightStyle accept a function with range as argument.

gabrielbuzziv avatar Mar 04 '21 18:03 gabrielbuzziv

@gabrielbuzziv @132lilinwei Please check the 1.1.0-beta.0 version, you can now pass a function (the doc has been updated). (demo https://ydeshayes.github.io/react-highlight/)

this version contain a big refactor as well, so it need some tests.

ydeshayes avatar Mar 06 '21 15:03 ydeshayes

Published in 1.1.0

ydeshayes avatar Feb 05 '23 14:02 ydeshayes