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.

Please allow styling of event colors with css variables by switching to ngStyle

See original GitHub issue

Hi Matthew

Would it be possible to switch the css attribute used for styling an event color and border to use the angular notation? Doing this would allow an end-user to leverage css variables and make our css less hard coded.

For example within the calendar-week-view-event-component.ts, you will find <div class="cal-event" [style.backgroundColor]="weekEvent.event.color?.secondary" [style.borderColor]="weekEvent.event.color?.primary" ....

Ideally, we would like to see: <div class="cal-event" [ngStyle.backgroundColor]="weekEvent.event.color?.secondary" [ngStyle.borderColor]="weekEvent.event.color?.primary" ...

This would allow us to change our css file from say:

Blue: { primary: '#89CFF0', // --nw-color-spectrum-blue-light secondary: '#B3F0FE' // --nw-color-brand-1 } to:

Blue: { primary: 'var(--nw-color-spectrum-blue-light)', secondary: 'var(--nw-color-brand-1)' } Does that make sense? Please let me know if you need additional info.

Thanks, Robert.

Minimal reproduction of the problem with instructions

Versions

  • angular-calendar:
  • Browser name and version: Chrome v71

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mattlewis92commented, Apr 1, 2019

Fixed in 0.27.2 🎉

1reaction
gtoroptsevcommented, Apr 1, 2019

Fixed in 0.27.2 🎉

thank you, it works now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using ngStyle in Angular for dynamic styling
In this article, we will look at how to style elements inline using the style attribute. Even more excitingly, we will explore how...
Read more >
NgStyle & NgClass • Angular - codecraft.tv
The NgStyle directive lets you set a given DOM elements style properties. This sets the background color of the div to green. The...
Read more >
ngStyle in Angular for Dynamic styling
In this blog, we will be going to learn about the styling of Angular components using the ngStyle core directives.
Read more >
Binding CSS Styles to Events in Angular Applications
Now, there are “pure” CSS variables. These are defined by prefixing a double dash (–) before the variable name. Then, to access the...
Read more >
Angular ngStyle Dynamic Styling Element with ngIf
If the else block is used only to color the background, then it could be skipped entirely using [style.background-color] and the ternary ...
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