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

Multiple row ranges display different highlight colors #2379

Open
jianghong3 opened this issue May 13, 2020 · 8 comments
Open

Multiple row ranges display different highlight colors #2379

jianghong3 opened this issue May 13, 2020 · 8 comments

Comments

@jianghong3
Copy link

Motivation
Please explain the problem you're having/why you propose this feature. Ex. I'm always frustrated when [...]

Description
A clear and concise description of what you want to happen.

For example, it is required that lines 1-3 are highlighted red and lines 4-9 are highlighted green. What should I do???

Alternatives
A clear and concise description of any alternative solutions or features you've considered, if applicable.

@RunDevelopment
Copy link
Member

Right now, Line highlight can be used to highlight specific lines but it cannot light them in different colors.

That being said: Red and green? This is just a guess but are you trying to highlight a diff? If so, then you can use Difff Highlight.

@jianghong3
Copy link
Author

How to specify which lines are highlighted with what color? Is there a complete example? It's just part of the official website

@RunDevelopment
Copy link
Member

Difff Highlight is intended for diffs (e.g. git diffs you can also see on Github). This was just a guess of mine that this might have been what you wanted to do.

It's not possible to specify a specific color (or similar) for a specific line with Line Highlight. Maybe you could use Keep Markup to mark some text instead (you can set the color via CSS)?

@galaxy4public
Copy link

I just raised #2389 which is a PR for a new plugin that makes it possible to control lines via CSS, so, maybe, this is something that could help with the original question? using Lines one should be able to achieve what's requested with CSS looking as follows:

pre div.lines:nth-of-type(n+1):nth-of-type(-n+3) {
  background: red;
}

pre div.lines:nth-of-type(n+4):nth-of-type(-n+9) {
  background: green;
}

@jianghong3
Copy link
Author

I went to the official website to see the demo. I don't understand how does it distinguish different code blocks

@jianghong3
Copy link
Author

@galaxy4public Where can the plug-in you mentioned set the color difference between different code blocks

@galaxy4public
Copy link

galaxy4public commented May 17, 2020

The plugin does not do any styling, it enables you to use CSS styling, so you can use CSS selectors to choose where to apply styles. For example, you can assign different ids or classes to your code blocks, then use that information to define your CSS rules.

@ghost
Copy link

ghost commented May 20, 2020

I would like to use something like that for displaying some test coverage.

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

3 participants