question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with background-blend-mode in CSS

See original GitHub issue

For some reason -blend-mode is out of hljs-attribute scope:

background-image: url(images/sample.png);
background-color: red;
background-blend-mode: multiply;
<span class="hljs-attribute">background</span>-blend-mode<span class="hljs-value">: multiply;</span>

screen shot 2014-08-16 at 20 14 25

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
isagalaevcommented, Aug 19, 2014

Yes, we could just add background-blend-mode to fix this particular case. I’ll gladly merge the pull request for that, as it won’t break anything.

This doesn’t really solve the problem though: new properties appear constantly and nobody wants to maintain it. And if you add SVG and potentially every XML application that could be styled this simply looks unfeasible.

What we could do is similar to what @tonyganch is describing: we could define “css-properties” as a separate language and use it inside CSS as well as on its own. But it’ll have to wait some time as it must be done carefully and we have a release planned for tomorrow 😃.

BTW, the approach “try everything and stick with what worked” isn’t really that slow. In fact, it’s how we do language detection: we literally try to highlight code with every language we known and stick with the one that successfully highlighted most stuff. The secret of being fast is to bail out early on obvious erros, which is why CSS defined strictly.

0reactions
joshgoebelcommented, Oct 7, 2019

If you’re wanting a fix just for yourself I’d consider what I just suggested… and make sure you explicitly label your blocks CSS.

I just tried VS Code just now and even it can’t properly colorize CSS “out of context”. If you had a blog or somewhere where you constantly were posting such things I’d almost suggest you whip up your own cssprops grammar just for this usage.

Closing because it’s really impossible to resolve this while keeping auto-detect in mind.

Also just wrapping the whole thing in {} without a selector even seems to work if you were willing to change your snippets:

{ background-image: url(images/sample.png);
background-color: red;
background-blend-mode: multiply; }
Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Blend Mode not working - Stack Overflow
I would like to play with the CSS blend mode property but it seems like nothing is happening when I apply the rules....
Read more >
background-blend-mode - CSS: Cascading Style Sheets | MDN
If the blending modes' and background images' list lengths are not equal, it will be repeated and/or truncated until lengths match.
Read more >
background-blend-mode | CSS-Tricks
The background-blend-mode property defines how an element's background-image should blend with its background-color:
Read more >
Mix-blend-mode not working - Custom code - Forum | Webflow
In order for the mix-blend-mode style to work, you need to have a background color set for your main container element—even if you're...
Read more >
CSS background-blend-mode | Can I use... Support ... - CanIUse
CSS background-blend-mode. - CR. Allows blending between CSS background images, gradients, and colors. Usage % of ... Known issues (1) Resources (5)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found