Implementing Dynamic Business Hours with Custom Colors in Vue-Cal #84
GerardoIbarra
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How to implement dynamic business hours with custom colors in Vue-Cal (not covered in docs)
Problem Identified
I've been working with Vue-Cal and encountered a scenario that's not covered in the official documentation: business hours with custom colors that come dynamically from an API.
The current documentation at Special Hours only shows static examples, but what happens when you need dynamic colors per provider?
What I Searched For
Vue-Cal official documentation
Existing issues in the repo
Stack Overflow and GitHub Discussions
Community examples
Result: I couldn't find a complete solution for this use case.
Solution I Implemented
I developed a solution that combines:
Store Pattern with Pinia for state management
Dynamic CSS generation based on API colors
Runtime CSS injection for Vue 3 compatibility
Native Vue-Cal integration using special-hours
Technical Implementation
Store for Dynamic CSS Generation
Hex to RGBA Conversion Function
Component with CSS Injection ( this is in the componeneten but you would move an store)
Vue-Cal Integration
Expected Data Structure
Detected CSS
Clean styles when change of page
This implementation creates a reactive system where business hours are not just static visual elements, but dynamic, data-driven components that automatically adapt to different providers and color schemes. The solution bridges the gap between Vue-Cal's static special-hours feature and real-world applications that need dynamic theming.
Beta Was this translation helpful? Give feedback.
All reactions